How is it possible with active_record?
u = User.all
u = u.where(:id => 1)
NoMethodError: undefined method `where' for # u.class => Array
Can't chain conditions :(
How is it possible with active_record?
u = User.all
u = u.where(:id => 1)
NoMethodError: undefined method `where' for # u.class => Array
Can't chain conditions :(
The all
method executes the query. So you can't chain after using it.
u = User.where(:id => 1)
u.where(:id => 2)
This would execute the query WHERE id = 1 AND id = 2