Corrected with rubocop cop 'Rails/Validation'.
This commit is contained in:
parent
3cefc118c9
commit
9cd4bb748a
2 changed files with 7 additions and 8 deletions
|
@ -266,8 +266,6 @@ Style/InfiniteLoop:
|
|||
Enabled: false
|
||||
Lint/AmbiguousRegexpLiteral:
|
||||
Enabled: false
|
||||
Rails/Validation:
|
||||
Enabled: false
|
||||
Lint/Eval:
|
||||
Enabled: false
|
||||
Style/ModuleFunction:
|
||||
|
|
|
@ -5,8 +5,9 @@ class Authorization < ApplicationModel
|
|||
after_create :delete_user_cache
|
||||
after_update :delete_user_cache
|
||||
after_destroy :delete_user_cache
|
||||
validates_presence_of :user_id, :uid, :provider
|
||||
validates_uniqueness_of :uid, scope: :provider
|
||||
validates :user_id, presence: true
|
||||
validates :uid, presence: true, uniqueness: { scope: :provider }
|
||||
validates :provider, presence: true
|
||||
|
||||
def self.find_from_hash(hash)
|
||||
auth = Authorization.where( provider: hash['provider'], uid: hash['uid'] ).first
|
||||
|
|
Loading…
Reference in a new issue