parent
4ec1c1ce26
commit
eb3d317a5c
@ -0,0 +1,15 @@
|
||||
class SetSizeOnCreatures < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
Creature.all.each do |creature|
|
||||
creature.size = case creature.health_points
|
||||
when 0..10
|
||||
:small
|
||||
when 11..30
|
||||
:big
|
||||
else
|
||||
:giant
|
||||
end
|
||||
creature.save!
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in new issue