Skip to content

Instantly share code, notes, and snippets.

@jaymiejones86
Created June 12, 2017 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaymiejones86/44bec13040131cd45b7df5c73d20eebe to your computer and use it in GitHub Desktop.
Save jaymiejones86/44bec13040131cd45b7df5c73d20eebe to your computer and use it in GitHub Desktop.
Hanami Interactor Example
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