This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Action | |
attr_reader :data, :current_user, :request | |
def self.run(**args, &block) | |
context = args.delete(:context) | |
action = new(**args) | |
action.context = context unless context.blank? | |
action.run(&block) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def call | |
ActiveRecord::Base.transaction do | |
# use create! to ensure errors are raised if the create method fails | |
account = Account.create!(payload) | |
balance = Balance.create!(account: account) | |
# this may cause a corner case where if #send_new_account_notification raises an error, | |
# the account and balance records will be rolled back | |
# depending on the business logic requirements, this may be taken out of this block | |
send_new_account_notification(account) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TaskOptions> | |
<TaskOptions> | |
<option name="arguments" value="--config=$ProjectFileDir$/.eslintrc $FileDir$/$FileName$ --fix" /> | |
<option name="checkSyntaxErrors" value="true" /> | |
<option name="description" /> | |
<option name="exitCodeBehavior" value="ERROR" /> | |
<option name="fileExtension" value="jsx" /> | |
<option name="immediateSync" value="false" /> | |
<option name="name" value="ESLint Fix JSX" /> | |
<option name="output" value="" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Useful Collections | |
def a_array | |
(1..6).to_a | |
end | |
def a_hash | |
{hello: "world", free: "of charge"} | |
end |