I get an error:
No route matches {:controller => :controller,
:action=>"add_groups"}
when loading a form under "users" containing:
<% form_remote_tag :url => { :controller => :users, :action =>
:add_groups } do %>
....
<% end %>
I do have an "add_groups" method in UsersController. I have not messed
with routes.rb, just a standard mapping automatically added by scaffold:
map.resources :users
The form is already in the "users" folder so :controller => should
be
redundant, tried with and without it and no matter what always get "no
route matches".
Any ideas?
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, Aug 17, 2010 at 6:29 PM, Tomasz Romanowski <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I get an error: > > No route matches {:controller => :controller, :action=>"add_groups"} > > when loading a form under "users" containing: > > <% form_remote_tag :url => { :controller => :users, :action => > :add_groups } do %> > .... > <% end %> > > I do have an "add_groups" method in UsersController. I have not messed > with routes.rb, just a standard mapping automatically added by scaffold: > > map.resources :usersA route to :add_groups isn''t provided by the map.resources :users entry, you have to add a custom route for that action. http://api.rubyonrails.org/classes/ActionController/Resources.html You can see what routes you have available by running `rake routes`. -- Greg Donald destiney.com | gregdonald.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks Greg. I''ve added the following to my routes.rb:
map.add_groups ''/users/add_groups/:id'', :controller =>
''users'', :action
=> ''add_groups''
And changed url in form_remote_tag to:
<% form_remote_tag :update => ''divgrouptable'', :url
=>
add_groups_path(@user) do %>
...
and got it to work.
However, I cannot say I understand why I''d have to do this. I
don''t
really want to map the add_groups method to any url. In my original
example I was specifying the method name and the controller name in the
url:
<% form_remote_tag :url => { :controller => :users, :action =>
:add_groups } do %>
which should tell rails everything it needs to know to invoke the right
method in the right controller, routing should not have anything to do
with that. I understand that it obviously does but I don''t understand
why.
Greg Donald wrote:> On Tue, Aug 17, 2010 at 6:29 PM, Tomasz Romanowski
> <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:
>>
>> I do have an "add_groups" method in UsersController. I have
not messed
>> with routes.rb, just a standard mapping automatically added by
scaffold:
>>
>> map.resources :users
>
> A route to :add_groups isn''t provided by the map.resources :users
> entry, you have to add a custom route for that action.
>
> http://api.rubyonrails.org/classes/ActionController/Resources.html
>
> You can see what routes you have available by running `rake routes`.
>
>
> --
> Greg Donald
> destiney.com | gregdonald.com
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.