Created
June 12, 2017 23:39
-
-
Save jaymiejones86/44bec13040131cd45b7df5c73d20eebe to your computer and use it in GitHub Desktop.
Hanami Interactor Example
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
require 'hanami/interactor' | |
class CreateOrganisation | |
include Hanami::Interactor | |
def initialize(params) | |
params[:id] = NormalizeParameterName.format(params[:id]) | |
@params = params | |
@organisation = Organisation.new(@params) | |
end | |
def call | |
@organisation = OrganisationRepository.new.persist(@organisation) # fails with: NoMethodError Exception: undefined method `persist' for #<OrganisationRepository relations=[:organisations]> | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment