diff options
author | David Gay <david@davidgay.org> | 2021-05-02 20:28:53 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-05-02 20:40:37 -0400 |
commit | cd04bcc4b4e4f5174d2f042bfcf6b840e6e18fee (patch) | |
tree | 30f869867ff5b120255febe3db47dacd28f432f0 /app | |
parent | 2b32a88a8e9f1d0bb5055843ac987d9cb9981803 (diff) |
Add Characters
Diffstat (limited to 'app')
-rw-r--r-- | app/models/character.rb | 5 | ||||
-rw-r--r-- | app/models/user.rb | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/app/models/character.rb b/app/models/character.rb new file mode 100644 index 0000000..1c022ea --- /dev/null +++ b/app/models/character.rb @@ -0,0 +1,5 @@ +class Character < ApplicationRecord + belongs_to :user + belongs_to :activity, optional: true + validates :name, presence: true +end diff --git a/app/models/user.rb b/app/models/user.rb index 6083f21..59d9ac3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -3,4 +3,6 @@ class User < ApplicationRecord # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable, :trackable, :confirmable, :lockable + has_many :characters + belongs_to :active_character, class_name: "Character", optional: true end |