Hi,
I am going through a tutorial in a rails book. I have Something off with
routes:
I have RESTful resource in routes.rb:
"...
map.resources :users, :member => { :enable => :put } do |users|
users.resources :roles
end
..."
and in a html.erb partial I have:
"...
<%= link_to ''assign role'',
role_url(:id => role.id, :user_id => @user.id),
:method => :put %>
..."
I get:
NoMethodError in Roles#index
Showing roles/_role.html.erb where line #9 raised:
undefined method `role_url'' for #<ActionView::Base:0x3637bdc>
I might be using newer version of rails than the book. The role_url is
not an explicitly defined route in this tutorial routes.rb file, I
don''t
know enough about RoR, but I am guessing the role_url should be
automatically available, so I would appreciate any help with this
because my RoR learning is halted here.
Cheers,
Mark
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
If you nest your resources as you do, then the url will need all parts of it like: user_role_path(@user, role) As parameters it takes the resource ids as default, so you don''t need the :id and the :user_id here --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
and don''t forget that you can use rake routes to see all your available routes at any given time, and their corresponding controllers and actions. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---