Properly namespacing the route resources as you suggested seems to fix
the delete problem. Thanks a bunch.

Is this to say that active_scaffold has moved away from supporting the
old school default routes and will only work when using RESTful
routes? The wiki on github still implies that this is optional. I
would just like to understand what the correct approach is and why, as
I have been using active_scaffold without the additional route
resources for some time now, and I have quite a few models/scaffolds
in my application.

On Jul 17, 5:34 pm, David Cato <[email protected]> wrote:
> Courtland wrote ...
>
> > The generateddeleteURL is.
>
> >http://localhost:3000/admin/scaffolds/users/delete/64?_method=delete&;...
>
> > 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to