Browse Source

Validate names are present

Chris Oliver 7 years ago
parent
commit
0975ff696e
1 changed files with 2 additions and 0 deletions
  1. 2 0
      app/models/user.rb

+ 2 - 0
app/models/user.rb

@@ -4,6 +4,8 @@ class User < ApplicationRecord
   devise :masqueradable, :database_authenticatable, :registerable,
          :recoverable, :rememberable, :trackable, :validatable
 
+  validates :first_name, :last_name, presence: true
+
   def name
     "#{first_name} #{last_name}"
   end