开发者

logout_path undefined for RoR site with authlogic

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 t开发者_开发问答he 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"


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  


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜