summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-05-26 18:48:38 -0400
committerDavid Gay <david@davidgay.org>2021-05-26 18:48:38 -0400
commit97c076b3c489c0dc81c7c3bb9ceddd35a86c01c5 (patch)
tree898c9af105602590dc5a195572c81fbcc06e10ab /app/models
parentc9ce866f6f77cad6335b87efd0f4886737628981 (diff)
Set default Character wounds to 0
Diffstat (limited to 'app/models')
-rw-r--r--app/models/character.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/character.rb b/app/models/character.rb
index 92e84c7..c0f785f 100644
--- a/app/models/character.rb
+++ b/app/models/character.rb
@@ -17,6 +17,8 @@ class Character < ApplicationRecord
validates_uniqueness_of :name, message: "is already being used"
validates_format_of :name, with: /\A[a-z]+\z/i, message: "must consist of letters only"
+ attribute :wounds, :integer, default: 0
+
after_create :create_skills
after_create { Hearth.create(character: self) }