# No route matches ..... for form\_remote\_tag

**URL:** <https://www.ruby-forum.com/t/no-route-matches-for-form-remote-tag/193455>\
**Category:** Rails\
**Created:** [August 18, 2010, 1:29am UTC](https://www.ruby-forum.com/t/no-route-matches-for-form-remote-tag/193455 "2010-08-18T01:29:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![techy\_bolek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee59a6/32.png) [@techy\_bolek](https://www.ruby-forum.com/u/techy_bolek)\
**Post date:** [August 18, 2010, 1:29am UTC](https://www.ruby-forum.com/t/no-route-matches-for-form-remote-tag/193455/1 "2010-08-18T01:29:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![techy\_bolek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee59a6/32.png) [@techy\_bolek](https://www.ruby-forum.com/u/techy_bolek)\
**Post date:** [August 18, 2010, 6:08am UTC](https://www.ruby-forum.com/t/no-route-matches-for-form-remote-tag/193455/2 "2010-08-18T06:08:57Z")

</div>

On Tue, Aug 17, 2010 at 6:29 PM, Tomasz R.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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](http://api.rubyonrails.org/classes/ActionController/Resources.html)

You can see what routes you have available by running `rake routes`.

–  
Greg D.  
[destiney.com](http://destiney.com) | [gregdonald.com](http://gregdonald.com)

---

<div class="post-metadata">

**Author:** ![techy\_bolek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee59a6/32.png) [@techy\_bolek](https://www.ruby-forum.com/u/techy_bolek)\
**Post date:** [August 19, 2010, 4:26pm UTC](https://www.ruby-forum.com/t/no-route-matches-for-form-remote-tag/193455/3 "2010-08-19T16:26:36Z")

</div>

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 D. wrote:

> On Tue, Aug 17, 2010 at 6:29 PM, Tomasz R.  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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](http://api.rubyonrails.org/classes/ActionController/Resources.html)
> 
> You can see what routes you have available by running `rake routes`.
> 
> –  
> Greg D.  
> [destiney.com](http://destiney.com) | [gregdonald.com](http://gregdonald.com)
