I'm working on an app where users can share photos. The photos can optionally belong to a collection, but don't have to.
Currently users can look through all photos via: photos/id
. I think it would also make sense if they could browse through the photos for a particular collection through collections/id/photos
So, this would mean that photos were both a top level resource and a nested resource. I suppose I could set this up in the routes like so:
resources :photos
resources :collections do
resources :photos
end
Is this a good idea, or is there a better way to reuse the photo model while also allowing it to act as nested under collections when appropriate? I'd very much appreciate suggestions as to the "rails way" of handling this kind of scenario.
Thanks!