Bourne,

In your example, *add* is like *new. *It should not be a member action, it
is a collection one.

I think what you are asking for is a bit more elaboration of the default
REST routes.

When you do:

resources  :priorities

This will generate the 7 default routes. which are two types:

   1. Member (you are operating on a specific instance of the priorities).
   and those are:  Show, Edit, Update, Destroy
   2. Collection, Where you operate on prorities in general, but not an
   existing one of them. which is   :index, :new,  :create


for member based actions,  the paths generated in a singular form and
expects the ID to be passed. so

add_priority_path   # wrong,  you have not provided an id or an instance of
Priority
add_priority_path(object)  # should work,   but this is not what u want.

new_priority_path  is actually a collection.  the route will be
/priorities/new






On Mon, Dec 20, 2010 at 9:50 AM, bourne <bour...@gmail.com> wrote:

> Thank you! Your post is really helpful.
>
> As mentioned above, I just want to understand how I would declare the 7
> REST routes if they would not have been declared for me, e.g. new1 (add in
> my example), edit1, ...
> If I declare add as a collection route, this statement throws an error
> <%= link_to 'Add Priority', add_*priority*_path %>         (taken from
> originally created code :  <%= link_to 'New Priority', new_priority_path %>)
>
> <%= link_to 'Add Priority', add_*priorities*_path %> works as expected.
>
> My original question was: what is my definition missing compared to the
> original new?
>
>
> Second, I find this very interesting: get 'add' => 'priorities#create', :as
> => my_custom_add
> In this form I get an error, the same with :my_custom_add.
>
>  --
> 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<rubyonrails-talk%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>



-- 
Mahmoud Said
Software Engineer - eSpace
blog.modsaid.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 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