Wednesday, 7 August 2013

get values from sql in a rake task

get values from sql in a rake task

I am looking to retrieve some values from my SQL database. In my rake task
I need to check if a table has any values and if so I need to do them in a
variable.
i have @db = ActiveRecord::Base.establish_connection( :adapter =>
"mysql2", :host => "localhost", :username => "root", :password => "",
:database => "devel_locations" )
and @db.connection.execute("SELECT * FROM associates WHERE code='1234'
LIMIT 1" )
how can i go about getting that information out and manipulating it

No comments:

Post a Comment