Browse Source

Merge branch 'wheelsize-list' of https://github.com/spacemunkay/velocipede into wheelsize-list

topic-sass
root 11 years ago
parent
commit
6e92d343a5
  1. 4
      db/migrate/20131019170248_alter_bike_wheel_to_id.rb

4
db/migrate/20131019170248_alter_bike_wheel_to_id.rb

@ -4,7 +4,7 @@ class AlterBikeWheelToId < ActiveRecord::Migration
undetermined_id = BikeWheelSize.find_by_rdin("0") undetermined_id = BikeWheelSize.find_by_rdin("0")
Bike.find_each do |bike| Bike.find_each do |bike|
wheel_size = BikeWheelSize.find_by_rdin(bike.wheel_size.to_s) wheel_size = BikeWheelSize.find_by_rdin(bike['wheel_size'].to_s)
if wheel_size.nil? if wheel_size.nil?
wheel_size_id = undetermined_id wheel_size_id = undetermined_id
@ -23,7 +23,7 @@ class AlterBikeWheelToId < ActiveRecord::Migration
add_column :bikes, :wheel_size, :integer add_column :bikes, :wheel_size, :integer
Bike.find_each do |bike| Bike.find_each do |bike|
wheel_size = BikeWheelSize.find_by_id(bike.bike_wheel_size_id) wheel_size = BikeWheelSize.find_by_id(bike['bike_wheel_size_id'])
bike.wheel_size = wheel_size.rdin.to_i bike.wheel_size = wheel_size.rdin.to_i
bike.save bike.save
end end

Loading…
Cancel
Save