diff options
author | Matthew Lemon <y@yulqen.org> | 2024-11-11 16:19:44 +0000 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-11-11 16:19:44 +0000 |
commit | 97201e0bca203b6b303789374ffd7e4228e062a7 (patch) | |
tree | 1d70b0c499c514ceccd906b6b6e85dcbacbd3f45 /app/models |
initial after migration
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/application_record.rb | 3 | ||||
-rw-r--r-- | app/models/concerns/.keep | 0 | ||||
-rw-r--r-- | app/models/current.rb | 4 | ||||
-rw-r--r-- | app/models/session.rb | 3 | ||||
-rw-r--r-- | app/models/user.rb | 6 |
5 files changed, 16 insertions, 0 deletions
diff --git a/app/models/application_record.rb b/app/models/application_record.rb new file mode 100644 index 0000000..b63caeb --- /dev/null +++ b/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + primary_abstract_class +end diff --git a/app/models/concerns/.keep b/app/models/concerns/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/app/models/concerns/.keep diff --git a/app/models/current.rb b/app/models/current.rb new file mode 100644 index 0000000..2bef56d --- /dev/null +++ b/app/models/current.rb @@ -0,0 +1,4 @@ +class Current < ActiveSupport::CurrentAttributes + attribute :session + delegate :user, to: :session, allow_nil: true +end diff --git a/app/models/session.rb b/app/models/session.rb new file mode 100644 index 0000000..cf376fb --- /dev/null +++ b/app/models/session.rb @@ -0,0 +1,3 @@ +class Session < ApplicationRecord + belongs_to :user +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..c88d5b0 --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,6 @@ +class User < ApplicationRecord + has_secure_password + has_many :sessions, dependent: :destroy + + normalizes :email_address, with: ->(e) { e.strip.downcase } +end |