フロントエンドプレイアブル
This commit is contained in:
15
app/models/user.rb
Normal file
15
app/models/user.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
class User < ApplicationRecord
|
||||
has_secure_password
|
||||
|
||||
validates :username, presence: true, length: { minimum: 3, maximum: 50 }
|
||||
validates :email, presence: true,
|
||||
uniqueness: { case_sensitive: false },
|
||||
format: { with: URI::MailTo::EMAIL_REGEXP }
|
||||
validates :password, length: { minimum: 6 }, if: -> { new_record? || !password.nil? }
|
||||
|
||||
before_save { self.email = email.downcase }
|
||||
|
||||
def admin?
|
||||
admin
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user