Rails have method where which returns Relation and find method which accepts entity and looks based on primary (you shouldn’t specify it explicit).
Is there any where method which accepts entity?
eg, User.where(params[:id]) -> select .. from users where user.id = …
If you already have the user record, why do you need to find it again using where? If it’s an association, you can do something like
User.where(:company_id => company.id), but you can’t pass the record itself.Also,
User.find(params[:id])is the same asUser.where(:id => params[:id]).first.