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
|
Enabled: false
|
||||||
Lint/AmbiguousRegexpLiteral:
|
Lint/AmbiguousRegexpLiteral:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
Rails/Validation:
|
|
||||||
Enabled: false
|
|
||||||
Lint/Eval:
|
Lint/Eval:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
Style/ModuleFunction:
|
Style/ModuleFunction:
|
||||||
|
|
|
@ -5,8 +5,9 @@ class Authorization < ApplicationModel
|
||||||
after_create :delete_user_cache
|
after_create :delete_user_cache
|
||||||
after_update :delete_user_cache
|
after_update :delete_user_cache
|
||||||
after_destroy :delete_user_cache
|
after_destroy :delete_user_cache
|
||||||
validates_presence_of :user_id, :uid, :provider
|
validates :user_id, presence: true
|
||||||
validates_uniqueness_of :uid, scope: :provider
|
validates :uid, presence: true, uniqueness: { scope: :provider }
|
||||||
|
validates :provider, presence: true
|
||||||
|
|
||||||
def self.find_from_hash(hash)
|
def self.find_from_hash(hash)
|
||||||
auth = Authorization.where( provider: hash['provider'], uid: hash['uid'] ).first
|
auth = Authorization.where( provider: hash['provider'], uid: hash['uid'] ).first
|
||||||
|
|
Loading…
Reference in a new issue