You are right. I think I just added the :only => [:index] to test the
concept. I  was trying to point out that even with:

  map.resources :lists, :shallow => true, :has_many => :items

The index action is called and you must handle the situation that this
only applies if :item_id is present.

In a more complex scenario, I posted a reply in the thread <http://
groups.google.com/group/rubyonrails-talk/browse_thread/thread/
d04c347caccc544a> that points out that you must handle the index
action based on the circumstance.

I may want to enter a nested route at some other point than the root
(company in the example). Project managers may want to enter nested
resources from a list of their current/active projects, or the boss
may want to see all current/active projects. Learning the RoR way of
defining these requirements has been a challenge. In some cases it
provides an elegant simple solution. In others it adds things you
didn't expect.

Steve Alex

On Sep 14, 6:51 am, Sijo Kg <[email protected]> wrote:
> Hi Steve Alex
>
>   I cant understand why you need
>
> map.resources :items, :only => [:index]
>
>      since item always coexist with lists So why it treated as seperate?
> Cant you do like
>
> map.resources :lists, :shallow => true, :has_many => :items
>
> And then in index of items as
>
> def index
>   �...@list_items = list.items
> end
>
> def list
>   @list = List.find(params[:list_id])
> end
>
> Sijo
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to