I have a Users model. Users 'have many' Stories, and Stories have many Items.
This structure allows the sharing of Items between Stories and Stories between Users. But given there is no direct 'ownership' link between Users and Items, what is the best way of building a list of Items which belong to a Story to which a given User has access. something like: current_user.stories.items obviously doesn't work. I've written some nested blocks ie: users.each do |user| user.stories.each.do |story| story.items.each.do |item| end end end which works but is ugly and slow. I could keep an index table of items linked to users but this is redundant for most of my application. I'm sure there is a more obvious, simple way of doing this but I haven't come across it. Any help gratefully received. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---