fix collection_weapon awakening_level default
set model-level default so validation passes before db default applies
This commit is contained in:
parent
99292f20ef
commit
e944f93ca3
1 changed files with 3 additions and 0 deletions
|
|
@ -8,6 +8,9 @@ class CollectionWeapon < ApplicationRecord
|
||||||
belongs_to :weapon_key3, class_name: 'WeaponKey', optional: true
|
belongs_to :weapon_key3, class_name: 'WeaponKey', optional: true
|
||||||
belongs_to :weapon_key4, class_name: 'WeaponKey', optional: true
|
belongs_to :weapon_key4, class_name: 'WeaponKey', optional: true
|
||||||
|
|
||||||
|
# Set defaults before validation so database defaults don't cause validation failures
|
||||||
|
attribute :awakening_level, :integer, default: 1
|
||||||
|
|
||||||
validates :uncap_level, inclusion: { in: 0..5 }
|
validates :uncap_level, inclusion: { in: 0..5 }
|
||||||
validates :transcendence_step, inclusion: { in: 0..10 }
|
validates :transcendence_step, inclusion: { in: 0..10 }
|
||||||
validates :awakening_level, inclusion: { in: 1..10 }
|
validates :awakening_level, inclusion: { in: 1..10 }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue