diff --git a/db/migrate/20130902201853_add_model_to_bike.rb b/db/migrate/20130902201853_add_model_to_bike.rb index f4d1a92..360b8b6 100644 --- a/db/migrate/20130902201853_add_model_to_bike.rb +++ b/db/migrate/20130902201853_add_model_to_bike.rb @@ -3,8 +3,7 @@ class AddModelToBike < ActiveRecord::Migration 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 + bike.update_attribute(:model, BikeModel.find_by_id(bike['bike_model_id']).model ) end end end