views:

66

answers:

1

Im trying to set up my app to work with authlogic.. the thing is, other than the fields authlogic is supposed to use I want to keep in my database other attributes Like Name, Last Name, PIN, etc... is there a way to do this?

+2  A: 

You say "keep" - do you mean you have an existing database of users and you want to keep this info as you migrate to AuthLogic, or do you mean you just want to store this additional info?

Either way is possible but I'm going to assume you mean that you just want to store additional information - all you have to do is script/generate migration AddFieldsToUser then edit the migration:

class AddFieldsToUser < ActiveRecord::Migration
  def self.up
    add_column :users, :name, :string
    add_column :users, :last_name, :string
    add_column :users, :pin, :integer
  end

  def self.down
    remove_column :users, :name
    remove_column :users, :last_name
    remove_column :users, :pin
  end
end

Then run rake db:migrate

mculp