views:

65

answers:

1

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'
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/url_rewriter.rb:208:in
rewrite_path'
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/url_rewriter.rb:187:in rewrite_url'
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/url_rewriter.rb:165:in
rewrite'
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:625:in url_for'
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_view/helpers/url_helper.rb:85:in
send'
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_view/helpers/url_helper.rb:85:in url_for'
(eval):17:in
edit_blog_path'
/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!!!

A: 

Go to terimnal and type

rake routes

It will show you all possible routes define in your routes.rb file. Then check edit_route_path is there or not

I have added the output of rake routes in the question
glatour
I have checked in my local its works.I edit_route_path(1)It give path /routes/1/edit
that's weird and I really don't understand this one, it should work find and I'm wonderring if it isn't something with my rails and ruby version... What versions do you have for rails?
glatour