Hi all,

I have two models gallery and photo (has_many -> belongs_to).
Can I use this to find the primary photo for the given gallery?

@gallery = @user.galleries
@primary_photo = @gallery.photos.find_by_primary(true).first

it ends with error.

Thanks for any help.
P.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to