Hello,
I am new to rails and I have a weird problem i don't understand...
I have created a basic application with only one controller. this controller is name routes (for testing purpose...) and it contains index, new and edit actions.
I have added a resource in the routes.rb file: map.resources :routes
The problem I have is when i try to make a link to an action like link_to edit_route_path(some id) I get the error undefined local variable or method `path' for #ActionController::Routing::RouteSet:0x101f4d088>
When I use routes_path directly, it works fine.
Thanks for your help!
output of rake routes:
routes GET /routes(.:format) {:controller=>"routes", :action=>"index"}
POST /routes(.:format) {:controller=>"routes", :action=>"create"}
new_route GET /routes/new(.:format) {:controller=>"routes", :action=>"new"}
edit_route GET /routes/:id/edit(.:format) {:controller=>"routes", :action=>"edit"}
route GET /routes/:id(.:format) {:controller=>"routes", :action=>"show"}
PUT /routes/:id(.:format) {:controller=>"routes", :action=>"update"}
DELETE /routes/:id(.:format) {:controller=>"routes", :action=>"destroy"}
/:controller/:action/:id
/:controller/:action/:id(.:format)
this is the error I have:
undefined local variable or method `path' for #ActionController::Routing::RouteSet:0x101f4d128>
and the stack trace:
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:386:in
generate'
rewrite_path'
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/url_rewriter.rb:208:in
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/url_rewriter.rb:187:inrewrite_url'
rewrite'
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/url_rewriter.rb:165:in
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:625:inurl_for'
send'
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_view/helpers/url_helper.rb:85:in
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_view/helpers/url_helper.rb:85:inurl_for'
edit_blog_path'
(eval):17:in
/Users/guillaume/Projets/rails/testroutes/app/views/blogs/edit.html.erb:4:in `_run_erb_app47views47blogs47edit46html46erb'
ruby version is 1.8.7 gem version is 1.3.7 rails version is 2.3.8
I tried the basic posts scaffold from the rails getting started user guide and i have the same error when I am in the new page or edit page...
ActionController::Routing::Routes.draw do |map|
map.resources :routes
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
end
The weird thing is that everything was working fine last week and I don't know what i have changed...
Thank you very much!!!