mirror of https://github.com/fspc/BikeShed-1.git
Browse Source
Leaving the bike_models table and bikes.bike_model_id column as a backup.eperez-timeinput
Jason Denney
11 years ago
6 changed files with 17 additions and 13 deletions
@ -0,0 +1,10 @@ |
|||||
|
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 |
Loading…
Reference in new issue