Class: Account::Service::Registration

Inherits:
Object
  • Object
show all
Defined in:
app/models/aikotoba/account/service/registration.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account_class: Account, confirm_service: Account::Service::Confirmation, confirmable: Account.confirmable?) ⇒ Registration

Returns a new instance of Registration.



9
10
11
12
13
# File 'app/models/aikotoba/account/service/registration.rb', line 9

def initialize(account_class: Account, confirm_service: Account::Service::Confirmation, confirmable: Account.confirmable?)
  @account_class = 
  @confirm_service = confirm_service
  @confirmable = confirmable
end

Class Method Details

.call!(account:) ⇒ Object



5
6
7
# File 'app/models/aikotoba/account/service/registration.rb', line 5

def self.call!(account:)
  new.call!(account: )
end

Instance Method Details

#call!(account:) ⇒ Object



15
16
17
18
19
20
# File 'app/models/aikotoba/account/service/registration.rb', line 15

def call!(account:)
  ActiveRecord::Base.transaction do
    .save!
    send_confirmation_token!() if @confirmable
  end
end