This project is archived and is in readonly mode.
In the new router, "can't use member outside resources scope"
Reported by Lasse Bunk | February 13th, 2010 @ 07:46 PM
In Rails 2.3.5 it was possible to have a member on a RESTful resource.
When trying this in Rails 3.0.0.beta:
resources :users do
resource :open_id do
member do
get :remove
end
end
end
It fails with:
ArgumentError: can't use member outside resources scope
The same occurs when using collection inside resource.
Is this on purpose, and if so, is there another solution?
Comments and changes to this ticket
-
Balazs Nagy February 13th, 2010 @ 08:08 PM
Why do you want to add a member to a single resource? Members expect that you want to reference of a resource by ID.
You can create extra routes for a resource like this:
resource :open_id do get :remove end
-
Lasse Bunk February 13th, 2010 @ 09:01 PM
Sorry – my bad. I'll be using get :remove instead. Thanks. Out of curiosity, could you tell me what would've been right one to use instead of using a member on Rails < 3.0.0?
-
Lasse Bunk February 13th, 2010 @ 09:50 PM
Another thing is that
get :remove
on a singular resource (resource :open_id
) doesn't create theremove_open_id_path
route helper that is created when usingmember do get :remove end
on plural resources (
resources :open_id
). Is that a bug? I can create the helper by specifying:as => :open_id
(why does it have to be:open_id
?) -
José Valim February 16th, 2010 @ 09:47 PM
- Assigned user set to josh
-
josh February 19th, 2010 @ 03:47 PM
- State changed from new to invalid
Right, you just need
resource :open_id do get :remove end
Think of the inside of "resource" (singular) as already scoped with member.
-
Lasse Bunk February 19th, 2010 @ 04:27 PM
Ok – I get that... nicely done :)
The fact that it doesn't create a remove_open_id helper – is that a bug? -
valerie82 June 7th, 2010 @ 10:19 PM
- Assigned user changed from josh to Aaron Patterson
nice to read write my essay
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>