Hello, I’m trying to use the authlogic to make my login in my app.
The problem is when I change my user model.
user model:
class User < ActiveRecord::Base
attr_accessible :crypted_password, :email, :password_salt,
:persistence_token, :username
acts_as_authentic
end
create_users migration
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :username
t.string :email
t.string :crypted_password
t.string :password_salt
t.string :persistence_token
t.timestamps
end
end
end
user controller
class UserController < ApplicationController
def index
end
end
database.yml
development:
adapter: mysql2
encoding: utf8
database: login_development
user: root
password:
pool: 5
timeout: 5000
The error is that:
StandardError in UserController#index
You must establish a database connection before using acts_as_authentic
app/models/user.rb:3:in <class:User>' app/models/user.rb:1:in
<top (required)>’
app/controllers/user_controller.rb:1:in `<top (required)>’
When I refresh the page, this error appears:
NoMethodError in UserController#index
undefined method `key?’ for nil:NilClass
How can I solve this ?
Thank you.