views:

37

answers:

2

Where is logout_path defined in the authlogic library for rails?

More generally, where are any of these paths defined? I'm a bit mystified how rails 'knows' where these are because I searched my entire project and didn't see any matches, including the vendor folder, which means that they're either packaged in a gem (maybe the authlogic gem?) or are convention rather than configuration.

I'm getting an undefined variable error:

ActionView::TemplateError (undefined local variable or method `logout_path' for #<ActionView::Base:0x7fcf9dd0a740>) on line #34 of app/views/layouts/application.html.erb:
31:   <%= link_to "My Account", account_path %> |
32:     <%= link_to "Edit Account", edit_user_path(:current) %> |
33:     <%= link_to 'Delete Account', user_path(@user), :method => :delete %> |
34:   <%= link_to "Logout", logout_path %>
35: <% end %>

here's the appropriate snippet from environment.rb:

  config.gem "ruby-openid", :lib => "openid"
  config.gem 'rack-openid', :version => '1.0.3', :lib => 'rack/openid'
  config.gem "authlogic"
  config.gem "authlogic-oid", :lib => "authlogic_openid"
  config.gem 'gravtastic', :version => '>= 2.1.0'
  config.gem "facebooker"
+1  A: 

Checkout the Railscast or the ASCIIcast on Authlogic.

They define the routes:

map.login 'login', :controller => 'user_sessions', :action => 'new'  
map.logout 'logout', :controller => 'user_sessions', :action => 'destroy'  
map.resources :user_sessions  
Bryan Ash
I think this might have worked? It makes sense... Unfortunately, I hit another speed bump as soon as I made this change (http://stackoverflow.com/questions/3199947/infinite-loop-in-authlogic-rails-app) and I'm not able to ascertain whether this helped. Will update in a bit. Thanks for the help!
unsorted
A: 

Hi,

There is no way to decalre directly login logout path by using authlogic . And if you want to define manully you can use "map.logout 'logout', :controller => 'user_sessions', :action => 'destroy' " in route.rb