Excerpts from John Merlino's message of Wed Mar 30 08:45:50 -0700 2011:
> So I try to implement:
>
> #routes
> resources :core do
> collection do
> get 'coreim'
> get 'corer'
> end
> end
With that routes file:
$ rake routes
coreim_core_index GET /core/coreim(.:format) {:action=>"coreim",
:controller=>"core"}
core_index GET /core(.:format) {:action=>"index",
:controller=>"core"}
POST /core(.:format) {:action=>"create",
:controller=>"core"}
new_core GET /core/new(.:format) {:action=>"new",
:controller=>"core"}
edit_core GET /core/:id/edit(.:format) {:action=>"edit",
:controller=>"core"}
core GET /core/:id(.:format) {:action=>"show",
:controller=>"core"}
PUT /core/:id(.:format) {:action=>"update",
:controller=>"core"}
DELETE /core/:id(.:format) {:action=>"destroy",
:controller=>"core"}
So you would have +coreim_core_index_path+, for example.
This rather surprised me, since I had the same expectations as you. Further
investigation suggestions inflections are to blame.
# config/routes.rb
# Note that we changed the resource to a pluralized form: "cores" instead of
"core".
resources :cores do
collection do
get 'coreim'
get 'corer'
end
end
$rake routes
coreim_cores GET /cores/coreim(.:format) {:action=>"coreim",
:controller=>"cores"}
cores GET /cores(.:format) {:action=>"index",
:controller=>"cores"}
POST /cores(.:format) {:action=>"create",
:controller=>"cores"}
new_core GET /cores/new(.:format) {:action=>"new",
:controller=>"cores"}
edit_core GET /cores/:id/edit(.:format) {:action=>"edit",
:controller=>"cores"}
core GET /cores/:id(.:format) {:action=>"show",
:controller=>"cores"}
PUT /cores/:id(.:format) {:action=>"update",
:controller=>"cores"}
DELETE /cores/:id(.:format) {:action=>"destroy",
:controller=>"cores"}
--
med vänlig hälsning
David J. Hamilton
--
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.