I have a belongs_to :from, :foreign_key => ‘from_user_id’ on my User
object
Now I want to do a User.find() with the :conditions of from = some user
id.
Is there anyway to use :conditions without the actual column name
‘from_user_id’, but instead using the association name ‘from’? It seems
this
would be the better way of doing it according to DRY, so I dont have to
duplicate the string ‘from_user_id’.
I have a belongs_to :from, :foreign_key => ‘from_user_id’ on my User object
Now I want to do a User.find() with the :conditions of from = some user id.
Is there anyway to use :conditions without the actual column name
‘from_user_id’, but instead using the association name ‘from’? It seems this
would be the better way of doing it according to DRY, so I dont have to
duplicate the string ‘from_user_id’.
No, AFAIK, the find method is not currently available on belongs_to and
has_one associations.
–
We develop, watch us RoR, in numbers too big to ignore.