Rails model with foreign key to itself
问题 I have an Oracle DB schema which includes a "users" table. This table has two non-null foreign keys to an editor and creator which are also users. The schema dump looks like this: create_table "users", :force => true do |t| t.integer "creator_id", :precision => 38, :scale => 0, :null => false t.integer "editor_id", :precision => 38, :scale => 0, :null => false end add_foreign_key "users", "users", :column => "creator_id", :name => "r_user_creatorid", :dependent => :nullify add_foreign_key