views:

753

answers:

2

Does anyone have an example of setting up Authlogic with a namespace in Rails? I have an "admin" namespace, which contains many "admin" related controllers (products, categories, etc.).

map.namespace :admin do |admin|
    admin.resources :products, :active_scaffold => true
    admin.resources :specials, :active_scaffold => true
    admin.resources :retailers, :active_scaffold => true
    admin.resources :terms, :active_scaffold => true
    admin.resources :users #, :active_scaffold => true
    admin.resources :faqs, :active_scaffold => true
    admin.resources :product_families, :active_scaffold => true
    admin.resources :product_types, :active_scaffold => true
    admin.resources :account, :controller => "users"
    admin.resources :user_session
end

Whenever I attempt to go to anything related to Authlogic (user_session, users), I'm getting an error that reads:

admin_ account _url failed to generate from {:controller=>"admin/users", :action=>"show"}

... which suggests an ambiguous route. But everything looks good to me when I run "rake routes". I've changed all references to just "account_url" in the code to associate with the namespace (admin). I just don't know what's going on at this point.

+1  A: 

The resource user_sessions shouldn't be in your admin namespace.

phillc
A: 

I posted on my blog about how I've set this up after I didn't have much luck finding any online examples working through this scenario either.

http://www.travisdunn.com/secure-rails-admin-backend-with-authlogic-and-multiple-sessions

Travis Dunn