1
0
mirror of https://github.com/fspc/BikeShed-1.git synced 2025-03-01 01:03:23 -05:00
BikeShed-1/db/migrate/20130902201853_add_model_to_bike.rb
Jason Denney 47f616b7b0 Moving bike model to the bikes table
Leaving the bike_models table and bikes.bike_model_id column as a backup.
2013-09-02 17:26:07 -04:00

11 lines
293 B
Ruby

class AddModelToBike < ActiveRecord::Migration
def change
add_column :bikes, :model, :string
change_column :bikes, :bike_model_id, :integer, :null => true
Bike.all.each do |bike|
bike.model = BikeModel.find_by_id(bike.bike_model_id).model
bike.save
end
end
end