diff options
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 |