Search code examples
ruby-on-railsrubyruby-on-rails-pluginsauthlogic

Authlogic and Namespace in Rails


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.


Solution

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