Class: ExternalAuthentication

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/monban/templates/app/services/external_authentication.rb

Instance Method Summary collapse

Constructor Details

#initialize(auth_hash) ⇒ ExternalAuthentication

Returns a new instance of ExternalAuthentication.



2
3
4
# File 'lib/generators/monban/templates/app/services/external_authentication.rb', line 2

def initialize(auth_hash)
  @auth_hash = auth_hash
end

Instance Method Details

#performObject



6
7
8
9
10
11
12
# File 'lib/generators/monban/templates/app/services/external_authentication.rb', line 6

def perform
  if scope.exists?
    scope.first
  else
    transaction { scope.create(user: user) }
  end
end