Monday, October 11, 2010

[Rails] Re: Need advice on controller / view

On Oct 11, 11:45 am, Erol Fornoles <erol.forno...@gmail.com> wrote:
> I prefer this approach:
>
> Have the following routes setup:
>
> map.resources :artists do |artists|
>   artists.resources :paintings
> end
> map.resources :paintings
[...]
> 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'.

This is certainly how I would do it. You've got a classic nested-
resources situation here.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate