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

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…

On Wed, 6 May 2009 08:27:42 -0700 (PDT)
flaubert [email protected] 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/

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!

On Wed, 6 May 2009 08:38:07 -0700 (PDT)
flaubert [email protected] 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/

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…