I want to retrieve status data from table projects in ror project.
the mysql code will be :
Setect status from projects where id = 2;
Im new to ror so I try use raw mysql to retrieve data:
sta1=Project.find_by_sql(["SELECT status FROM projects WHERE id = ?",id1]).first
This returns a #
I'm expecting a string either "on" or "off"
whats my problem?
...first.status.sta1 = Project.find(id1).statusis where'd you go if you're finding by id...ActiveRecordsnippets you can find are not enough for you, you can usearelthat defines queries similarly to SQL but with possibility to use Ruby in constructing it.