From rails console, running the following gives an unexpected result:
User.where(:id => [1,2]).where(:id => 2).arel.to_sql
=> "SELECT `users`.* FROM `users` WHERE (`users`.`id` IN (1, 2) OR `users`.`id` = 2)"
I'm not expecting that to be an OR
.
This example is a very simplified example of a tableless User
model I have that defines a method:
def cars
Car.where(:id => list_of_users_car_ids_not_from_the_database)
end
where Cars
are kept in the database. Then later in a controller
current_user.cars.find(params[:id])
(okay, this is also a simplified example, but much more representative of what I'm trying to accomplish)