Hi there,
I’m getting the error:
No route matches { :controller => “user/agentsubdomains”,
:action => “destroy_double”,
:subdomain_id => 7,
:agent_id => 11 }
Is it not possible to put as many “whatever_ids” as I want in the params
to use them in the controller? What would I have to do where?
The link looks like this:
<%= link_to_remote h(name), :url => { :controller =>
‘user/agentsubdomains’,
:action => ‘destroy_double’,
:subdomain_id => 7,
:agent_id => 11 },
:method => ‘delete’ %>
Thanks a lot for helping me out!
Tom
Tom Ha wrote:
Hi there,
I’m getting the error:
No route matches { :controller => “user/agentsubdomains”,
:action => “destroy_double”,
:subdomain_id => 7,
:agent_id => 11 }
Is it not possible to put as many “whatever_ids” as I want in the params
to use them in the controller?
What exactly are you trying to do? And what does the relevant part of
your routes file look like?
Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
I just need to assign values to
- params[:subdomain_id] and
- params[:agent_id]
which are in this case
…so I can access these values in the controller using the params.
And here’s the excerpt from routes.rb:
ActionController::Routing::Routes.draw do |map|
map.namespace :user do |user|
user.resources :agentsubdomains, :member => { :destroy_double =>
:delete }
[…]
end
map.resource :session
[…]
map.root :controller => “root”, :action => “index”
map.connect ‘*path’ , :controller => ‘four_oh_fours’
end
Tom Ha wrote:
I just need to assign values to
- params[:subdomain_id] and
- params[:agent_id]
which are in this case
You can always put in extra parameters as you’re trying to do. That’s
not the problem.
…so I can access these values in the controller using the params.
And here’s the excerpt from routes.rb:
ActionController::Routing::Routes.draw do |map|
map.namespace :user do |user|
user.resources :agentsubdomains, :member => { :destroy_double =>
:delete }
[…]
end
The problem lies here, I think. Either your controller name is invalid,
or you need a user_id. I’m not sure which, but between the routing docs
and your tests, you should be able to figure it out.
map.resource :session
[…]
map.root :controller => “root”, :action => “index”
map.connect ‘*path’ , :controller => ‘four_oh_fours’
end
Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
Thanks!
(Yes, it was the user_id that it needed…)
PS: Actually any id does the trick (even a constant ‘dummy’ integer).
It won’t be used, but the routing format apparently needs an id for the
path to be composed completely.
Tom Ha wrote:
PS: Actually any id does the trick (even a constant ‘dummy’ integer).
It won’t be used, but the routing format apparently needs an id for the
path to be composed completely.
That’s usually the way nested resources work by default. If it’s not
accurate for your use case, change your routes (perhaps you want
namespaced controllers instead).
Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]