[ROUTES] [RAILS 2.3] Custom controller method fires a route error


#1

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…


#2

On Wed, 6 May 2009 08:27:42 -0700 (PDT)
flaubert removed_email_address@domain.invalid wrote:

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?

map.connect ‘/import/generate/’, :controller => ‘import’, :action =>
‘generate’


Starr H.
Check out my Helpdesk RailsKit: http://railskits.com/helpdesk/


#3

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!


#4

On Wed, 6 May 2009 08:38:07 -0700 (PDT)
flaubert removed_email_address@domain.invalid wrote:

do i have to use this for any custom method that a have created?
there isn’t any dryer solution for this?

The dryer solution is to use map.resource & restful urls for most
actions, and use non-restful actions sparingly.


Starr H.
Check out my Helpdesk RailsKit: http://railskits.com/helpdesk/


#5

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…