Skip to content

Instantly share code, notes, and snippets.

@abinoam
Last active July 27, 2018 15:05
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 abinoam/a85c279dc07dca4cf7318aa789d746a2 to your computer and use it in GitHub Desktop.
Save abinoam/a85c279dc07dca4cf7318aa789d746a2 to your computer and use it in GitHub Desktop.
A Hanami Snippet to show a callable controller
# Example from: http://hanamirb.org/guides/1.2/getting-started/#implementing-create-action
module Web::Controllers::Books
class Create
include Web::Action
def call(params)
BookRepository.new.create(params[:book])
redirect_to '/books'
end
end
end
# Then I can do
create = Web::Controllers::Books::Create.new
create.(params)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment