Hi all,
I have a custom method in my controller called 'generate'.
when requested localhost:3000/import/generate I see "Couldn't find Import with ID=generate".
How customize a route for this method?
help please...
Hi all,
I have a custom method in my controller called 'generate'.
when requested localhost:3000/import/generate I see "Couldn't find Import with ID=generate".
How customize a route for this method?
help please...
map.connect '/import/generate/', :controller => 'import', :action => 'generate'
do i have to use this for any custom method that a have created?
there isn't any dryer solution for this?
tnks for reply!
try to put into config/routes.rb:
map.connect ‘:controller/:action’
after:
map.connect ‘:controller/:action/:id’
map.connect ‘:controller/:action/:id.:format’
final result:
map.connect ‘:controller/:action/:id’
map.connect ‘:controller/:action/:id.:format’
map.connect ‘:controller/:action’
Hope this helps…
The dryer solution is to use map.resource & restful urls for most actions, and use non-restful actions sparingly.