Reputation: 698
I am trying to replace the edit action of a controller with one having an extra parameter, but am getting:
undefined local variable or method `on' for #<ActionDispatch::Routing::Mapper:0x007fd3b4516a00>
Here is the routes.rb section:
resources :structures, except: :edit do
get '/:doctype' => :edit, on: :edit
end
The issue is :edit. Using another action like :new works perfectly.
Upvotes: 2
Views: 1756
Reputation: 6132
You can try this instead:
resources :structures, except: :edit do
get '/edit/:doctype' => :edit
end
The syntax you've tried to use is intended to be used with on: (new|member|collection)
. edit
is not a valid option here.
Upvotes: 2