Displaying 1 result from an estimated 1 matches for "find_by_status_name".
2006 Jun 08
1
question about finding with :include versus nested dynamic finder (bad form? efficiency?)
...given a certain
status, either "Accepted", "Rejected", "OnHold", "Declined", etc. I
need to find all users with a status of "Accepted", so I''m doing the
following:
in User.rb:
belongs_to :status
def accepted_users
status_id = Status.find_by_status_name(''Accepted'').id
self. find_all_by_status_id(status_id)
end
I realize that I can also perform the above query by using something like:
def accepted_users
User.find(:all, :include => ''status'', :conditions =>
''users.status_id = statuses.id an...