1

In rails 3.1.1, I have admin_root_path set in my routes.rb as:

namespace :admin do
  root :to => "base#index"
  resources :users
end

Which routes to the index action on the admin/base_controller. But for reasons beyond my control, I have to downgrade my rails 3 app to v2.3.14. I've tried:

map.namespace :admin do |admin|
  admin.resources :users, :controller => "base", :action => "index"
end

with no luck. I know it's weird to ask a "make my new code old" question, but what the heck. I guess that's why I'm not the boss??

Thanks, Chris

1 Answer 1

1

You have two options as far as I can see:

map.namespace :admin do |admin|
  admin.root :controller => "base"
  admin.resources :users, :controller => "users", :action => "index"
end

The above will give you the same admin_root_path as you were getting in Rails 3, but without the ability to have multiple formats. rake routes shows this as:

admin_root   /admin   { :controller => "admin/base", :action => "index" }

If you wish to have multiple formats in the same way as you could in Rails 3, then I think this is your only solution:

map.admin_root "/admin(.:format)", :controller => "admin/base", :action => "index"

map.namespace :admin do |admin|
  admin.resources :users, :controller => "users", :action => "index"
end

The above provides this for admin_root_path in Rails 2.3.14 which is exactly the same as what I'm seeing in Rails 3.0.11:

admin_root   /admin(.:format)   { :controller => "admin/base", :action=>"index" }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.