Reputation: 13
I'm trying to switch my app from rails 3.2 to 4.2.
q = User.find_all_by_attr(attr_value, :order => "name DESC", limit => 8).map { ... }
Since find_all_by_ is deprecated I've changed it to
q = User.where(:attr => attr_value, :order => "name desc", limit => 8).map { ... }
but now I am getting error that column name order doesn't exist.
What is a proper way to write this query in rails 4.2?
Same goes for User.find(:all). I've seen that using all is deprecated and am unable to find proper way.
Upvotes: 1
Views: 54
Reputation: 23661
Change it to
q = User.where(:attr => attr_value).order('name DESC').limit(8).map { ... }
Upvotes: 1