well if you want all the primary photos just use my suggested
named_scope. then you can ask:
@all_primary_photos = Photo.all.primary # or just Photo.primary
@all_galleries = Gallery.all
no loop needed. but if you want to loop, you can do that with
@all_galleries.each do |gallery|
# gallery.photos
end
On 27 Feb., 15:05, Petan Cert <[email protected]>
wrote:
> Eifion Bedford wrote:
> > It looks from your code as if you're returning a list of user galleries
> > rather than a single one, so the list you get won't have a photos
> > method.
> > Does your code work if you change the third line in your method to
>
> > @gallery = @user.galleries.first
>
> Yes, thats the error.
> Now it is working but just for the first one.
>
> Is there a way to loop all of the users galleries?
> Thank you.
>
> P.
>
> --
> Posted viahttp://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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---