I wonder is anyone can give me a pointer in the right direction.
we’ve recently upgraded our app to Rails 3. We previous had a
situation where it was necessary to allow our create action on a
resourceful controller to be accessible in the following way
GET /resources/create → ResourcesController#create
POST /resources → ResourcesController
This would do the job
resources :resources, :collection { :create => :get, :authorize => :get
}
and we’d get the following router helper to boot
create_resources_path/url
In Rails 3 this has changed however and now I’m finding it extremely
difficult to replicate
resources :resources do
collection do
get :create
get :authorize
end
end
This would be the most obvious way I would think to solve this.
but alas this route doesn’t exist
create_resources GET /resources/create → ResourcesController#create
however this does, so the create action is being treated differently
and so needs some other modification to make it work as I would like
it to.
authorize_resources GET /resources/authorize →
ResourcesController#authorize
The following does part of the job, but renders
resources :resources do
collection do
get :create, :as => ‘create’
get :authorize
end
end
create_resources GET /resources → ResourcesController#create
This of course then overrides the index route for this controller
resources GET /resources → ResourcesController#index
This also seems to have no effect?!?
resources :resources, :path_names => {:create => ‘create’ } do
collection do
get :create, :as => ‘create’
get :authorize
end
end
Can anyone help?
–
Rob L.
[email protected]