Displaying 1 result from an estimated 1 matches for "001_create_airports".
2010 Nov 09
2
Undefined method
...gn_key(from_table, from_column, to_table)
constraint_name = "fk_#{from_table}_#{to_table}"
execute %{alter table #{from_table}
add constraint #{constraint_name}
foreign key (#{from_column})
references #{to_table}(id)
}....
end
In my_app/db/migrate/001_create_airports.rb:
require "migration_helpers"
class CreateAirports < ActiveRecord::Migration
extend MigrationHelpers
def self.up
create_table (:airports, :options => "ENGINE=InnoDB") do |t|
t.integer :country_id, :null => false #foreign key
t.string :code, :nul...