Only set types during create
This commit is contained in:
parent
ea38a64ced
commit
5232273a37
1 changed files with 3 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
class Card < ActiveRecord::Base
|
class Card < ActiveRecord::Base
|
||||||
has_paper_trail
|
has_paper_trail
|
||||||
|
|
||||||
before_save :set_stat_types
|
after_create :set_stat_types
|
||||||
|
|
||||||
belongs_to :character
|
belongs_to :character
|
||||||
belongs_to :rarity
|
belongs_to :rarity
|
||||||
|
@ -55,5 +55,7 @@ class Card < ActiveRecord::Base
|
||||||
self.hp_stat.stat_type_id = 1
|
self.hp_stat.stat_type_id = 1
|
||||||
self.atk_stat.stat_type_id = 2
|
self.atk_stat.stat_type_id = 2
|
||||||
self.def_stat.stat_type_id = 3
|
self.def_stat.stat_type_id = 3
|
||||||
|
|
||||||
|
self.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue