1
0
mirror of https://github.com/fspc/BikeShed-1.git synced 2025-02-28 16:53:23 -05:00
BikeShed-1/db/migrate/20130902201853_add_model_to_bike.rb

10 lines
299 B
Ruby
Raw Normal View History

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|
2013-11-11 17:27:51 -05:00
bike.update_attribute(:model, BikeModel.find_by_id(bike['bike_model_id']).model )
end
end
end