class CreateMatches < ActiveRecord::Migration
def self.up
create_table :matches do |t|
t.integer :result_home
t.integer :result_away
t.references :clan, :as => :clan_home
t.references :clan, :as => :clan_away
t.references :league
t.timestamps
end
end
def self.down
drop_table :matches
end
end
I think code clears everything, I need to reference result_home to one clan and result_away to another. What is the best way to do so? I could create has_and_belongs_to_many but i think it's not good way in this case.