Courtland wrote ...
> The generated delete URL is.
>
> http://localhost:3000/admin/scaffolds/users/delete/64?_method=delete&authenticity_token=G6rRnB%2Bm4yhyzcuHdRbB64t6KuqrnXQuWAqwd3zbdEc%3D
>
> This does look like a routing problem of sorts. I did not have the
> "map.resources :users, :active_scaffold => true" in my routes, but
> adding such does not change the resulting URL nor does it resolve the
> exception.
Since you've namespaced your controller, you need to namespace the route
too. One possibility would be
map.namespace(:admin) do |admin|
admin.namespace(:scaffold) do |scaffold|
scaffold.resources :users, :active_scaffold => true
...
end
end
I've never tried a two-level namespace before so there might be a
simpler way to specify the routes, but I couldn't come up with anything
else that worked.
> Here are my routes.
>
> ActionController::Routing::Routes.draw do |map|
>
> map.root :controller => 'redirector', :action => 'index'
>
> map.resources :users
> map.resources :users, :active_scaffold => true
These would be for the top-level users controller, probably for things
like account signup and such. Since your admin controller is namespaced,
you need to remove, at least, the one with :active_scaffold => true.
> map.resources :admins
> map.resource :admin_session, :controller => '/admin/sessions'
>
> map.connect '/admin', :controller => '/admin/menu', :action =>
> 'instruments'
>
> map.connect ':controller/:action/:id.:format'
> map.connect ':controller/:action/:id'
Unless you have a really good reason for keeping these last two
old-style default routes, you're better off removing them and sticking
with RESTful and named routes only.
> map.connect '*anything', :controller => 'redirector', :action =>
> 'index'
>
> end
>From my working routes.rb with a single-level admin namespace, leaving
out the unrelated routes,
ActionController::Routing::Routes.draw do |map|
# For the public side (user signup, password change, etc.)
map.resources :users, :member => { :change_password => :get, :update_password
=> :put }
# For the admin side
map.namespace(:admin) do |admin|
admin.resources :users, :active_scaffold => true
end
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---