summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2023-02-21 19:37:19 -0600
committerHombreLaser <sebastian-440@live.com>2023-02-21 19:37:19 -0600
commit3ac50b5873bbbef65a5fb413a7df115475f88ba6 (patch)
tree973ef7ac5fe93191466e21ae1647bf7199275c31
parentcd750cf9d6eb9fadbcb8994d689980bf9c2bc241 (diff)
Añade rol al modelo de usuario
-rw-r--r--app/models/user_account.rb1
-rw-r--r--db/schema.rb3
2 files changed, 3 insertions, 1 deletions
diff --git a/app/models/user_account.rb b/app/models/user_account.rb
index d9d67a4..ceb8334 100644
--- a/app/models/user_account.rb
+++ b/app/models/user_account.rb
@@ -11,6 +11,7 @@ class UserAccount < ApplicationRecord
validates :email, presence: true
validates :first_name, presence: true
validates :last_name, presence: true
+ validates :role, presence: true, inclusion: { in: %w[master regular] }
def full_name
"#{first_name} #{last_name}"
diff --git a/db/schema.rb b/db/schema.rb
index 6948e6b..afe279a 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema[7.0].define(version: 2023_02_22_010138) do
+ActiveRecord::Schema[7.0].define(version: 2023_02_22_012901) do
create_table "user_accounts", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
t.string "email"
t.string "password_digest"
@@ -19,6 +19,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_02_22_010138) do
t.string "session_key"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
+ t.string "role"
end
end