开发者

authlogic rails help

Im trying to set up my a开发者_Go百科pp 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?


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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜