Hi Christian,

On Mon, Oct 11, 2010 at 10:33 AM, Christian Fazzini
<christian.fazz...@gmail.com> wrote:
> I was also thinking. Both "actions" should still call artists#index.
> In artist#index, I'll have an if condition that checks which template/
> view to render.
>
> Is this a sensible approach?
>
> On Oct 11, 11:29 pm, Christian Fazzini <christian.fazz...@gmail.com>
> wrote:
>> Need some advice. I've got two modules: artists and paintings.

Do you mean controllers?  Or do you mean modules?  For purposes of
this reply I'm assuming you mean controllers.

>>
>> 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?

The typical approach would be to add a list method to your controller.
 The default action of the index method is typically to list all
records, while a list method typically takes parameters used to filter
the returned records.  Assuming that you want to remain as RESTful as
possible, use list to return your 'list by artist' page.  List is a
RESTful method.  Index is not.  It's simply a method that's 'required'
in terms of normal web page naming.

HTH,
Bill

-- 
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-t...@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.

Reply via email to