diff options
-rw-r--r-- | app/models/application_record.rb | 1 | ||||
-rw-r--r-- | app/models/user_account.rb | 15 | ||||
-rw-r--r-- | db/migrate/20230222010138_create_user_accounts.rb | 13 |
3 files changed, 29 insertions, 0 deletions
diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 08dc537..b616159 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +# ApplicationRecord base class. class ApplicationRecord < ActiveRecord::Base primary_abstract_class end diff --git a/app/models/user_account.rb b/app/models/user_account.rb new file mode 100644 index 0000000..b54c93d --- /dev/null +++ b/app/models/user_account.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +# UserAccount model +# email: string +# password_digest (secure password): string +# first_name: string +# last_name: string +# session_key: string +class UserAccount < ApplicationRecord + has_secure_password validations: false + + def full_name + "#{first_name} #{last_name}" + end +end diff --git a/db/migrate/20230222010138_create_user_accounts.rb b/db/migrate/20230222010138_create_user_accounts.rb new file mode 100644 index 0000000..0219276 --- /dev/null +++ b/db/migrate/20230222010138_create_user_accounts.rb @@ -0,0 +1,13 @@ +class CreateUserAccounts < ActiveRecord::Migration[7.0] + def change + create_table :user_accounts do |t| + t.string :email + t.string :password_digest + t.string :first_name + t.string :last_name + t.string :session_key + + t.timestamps + end + end +end |