After
I'm trying to join When I try to use a join, test in console An example optimized rail guide I get an error message, Both models do is This should be done members.created_at :) Remember you use the name of the DB table clearly, that it is in plural by the rail conference. for the first time in Rails 3, and can not get it The most basic thing to do is to work, so some prominent must be remembered.
class members & lt; ActiveRecord :: base belongs_to: status ... end class status ActiveRecord :: base has_many: members ... end
time_range = (Time.now.midnight - 1.day) .. Time.now.midnight Status.joins (members) .where ('member.created_at '= & Gt; time_range)
ActiveRecord :: StatementInvalid: Mysql2 :: error: unknown column' member. 'Where segment' in created_at ': Include `statuses` * from` statuses` within `` members```status_id` = `statuses`.`id` (` members`.created_at` between members' 2011-03- 26 23:00 : 00 'and' 2011-03-27 23:00:00 ')
created_at column and it Works:
member. Where (: created_at => time_arange) . I have tried many permutations and have used different columns, but whenever I try to join it, same
unknown column gets error
Comments
Post a Comment