在rails 4.1枚举中如何在迁移中规定这样的东西?
class CreateFriendsUsers < ActiveRecord::Migration
def change
create_table :friends_users, id: false do |t|
t.integer :friend_id
t.integer :user_id
t.integer :status, [:active, :deactive]
end
end
end
这是用户和用户的连接表
has_and_belongs_to_many :friends,
:class_name => "User",
:foreign_key => "user_id",
:association_foreign_key => "friend_id",
:join_table => "friends_users",
:after_add => :add_friend,
:after_remove => :remove_friend