I prefer this approach: Have the following routes setup:
map.resources :artists do |artists| artists.resources :paintings end map.resources :paintings Or in Rails 3 resources :artists do resources :paintings end resources :paintings In your PaintingsController: def index @artist = Artist.find(params[:artist_id]) @paintings = @artist.paintings.all rescue Painting.all render 'index_by_artist' if params[:artist_id] end If an Artist is specified, via the URL /artists/1/paintings, it will load all Paintings from the specified Artist and render the view named 'index_by_artist'. If no Artist is given, using just the URL /paintings, it will load all Paintings and use the default view 'index'. On Oct 11, 11:29 pm, Christian Fazzini <[email protected]> wrote: > Need some advice. I've got two modules: artists and paintings. > > In my home page, I've got a 2nd page that says "Browse paintings", > which displays ALL paintings of ALL artists. This is being rendered by > paintings#index. > > In another page, I should show all paintings of a specific artist > ONLY. Meaning, paintings from ONE artist. I cant use paintings#index > for this anymore since it is already being used by the homepage. Also > take note, both pages are rendered differently (meaning, data and > display are not the same). They don't look alike. So I can't use index > for both pages. > > What approach would you take? > > I am thinking of creating a method in the artists module called: > list_paintings. And then in /app/views/list_paintings.html.erb > > What are your thoughts? -- 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.

