Trying to add authlogic in a simple project but get the error;

Showing app/views/layouts/application.html.erb where line #33 raised:
undefined method `underscore' for nil:NilClass
Extracted source (around line #33):
30:   <div id="mainleft">
31:      <ul class="menu">
32:             <li><%= nav_link "Home", "site", "index"  %></li>
33:         <% if current_user %>
34:              <li>The site</li>
35:         <% else %>
36:           <li><%= nav_link "Login", "authentications", "login"
%></li>

class ApplicationController < ActionController::Base
  protect_from_forgery
  filter_parameter_logging :password, :password_confirmation
  helper_method :current_user

  private
    def current_user_session
      return @current_user_session if defined?(@current_user_session)
      @current_user_session = Authentication.find
    end

    def current_user
      return @current_user if defined?(@current_user)
      @current_user = current_user_session &&
current_user_session.user
    end

authentication model
class Authentication < Authlogic::Session::Base
  authenticate_with User
end

user model
class User < ActiveRecord::Base
   acts_as_authentic do |c|
    c.session_class = Authentication
    c.login_field = :login
    c.ignore_blank_passwords = false
   end
end

routes in routes.rb
  map.root :controller => "site", :action => "index"
  map.resource  :authentications
  map.resources :users

  map.login  "login",  :controller =>"authentications", :action =>
"login"
  map.logout "logout", :controller =>"authentications", :action =>
"destroy"

The problem is in ApplicationController
      @current_user_session = Authentication.find
Authentication is not active?  I have  config.gem "authlogic" in
environment.rb file.

Any ideas?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to