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
| # Service objects are classes that inherit from this base and implement two instance methods: | |
| # * initialize(*args, **params) => void | |
| # * perform() => Promise | |
| class ServiceBase | |
| include ActiveModel::Validations | |
| # invokes the service and returns a Promise | |
| def self.perform(*args, **params) | |
| klass = params.any? ? new(*args, **params) : new(*args) | |
| klass.perform_in_transaction |
OlderNewer