Questions tagged [hanami]

Hanami is an open source web framework for Ruby developed by Luca Guidi.

Hanami is a web based framework for Ruby that puts the focus on simplicity, fewer DSL's, few conventions, more objects, zero monkey-patching of the core language and standard lib and separation of concerns for MVC layers.

It suggests patterns, rather than imposing patterns. It leaves all the freedom to developers to build their own architecture, choose the inheritance structure. It tries to simplify testability, and encourages single, well defined responsibilities between classes.

Hanami was formerly known as Lotus, the name was changed to avoid trademark issues.

90 questions
5
votes
1 answer

How to configure Puma for a Hanami Application?

I have a Hanami 1.3.3 application which should run with Puma as production webserver. I want to use puma in cluster mode and use preload_app properly. Now I'm struggling with the right Puma config. I know, that every child-process (worker) must have…
wuarmin
  • 3,274
  • 3
  • 18
  • 31
5
votes
3 answers

Hanami link_to helper renders only last element

i'm new in the Hanami World. I'have write this code: module Web::Views::Home class Index include Web::View include Hanami::Helpers::HtmlHelper def title html.header do h1 'Test search engine', id: 'title' hr …
DeepCode
  • 358
  • 2
  • 9
5
votes
3 answers

Implementing many-to-many (and other) relationships with Hanami

I searched the docs for how to implement relationships among entities (eg, one-to-many, many-to-many, etc), but didn't find any examples. So I tried a reasonable guess. Here's my attempt at implementing a Person who can be tagged with Tags: require…
Jonah
  • 15,806
  • 22
  • 87
  • 161
5
votes
1 answer

How to use lotus router with Rack::Builder::map

Is there a way to use map and the (lotus)router namespacing together? Below is a sample config.ru I'm trying to get running as a demo. require 'bundler' Bundler.require module Demo class Application def initialize @app =…
Krut
  • 4,112
  • 3
  • 34
  • 42
4
votes
1 answer

How to update only changed attributes in Hanami Model?

Given I am using Hanami Model version 0.6.1, I would like the repository update only the changed attributes of an entity. For example: user_instance1 = UserRepository.find(1) user_instance1.name = 'John' user_instance2 =…
Luiz A.
  • 43
  • 1
  • 5
4
votes
2 answers

2 field validation in Hanami + dry-validation

I've been trying to validate a sign in process using Hanami (which is on top of dry-validation). The point is: how to validate someting related to 2 fields: email + password? I've read about custom predicates, but they seem to be only per field.…
4
votes
1 answer

Join query in Hanami-model

Is it possible to create join query in subclass of Hanami::Repository? I found that this pull request implements this feature but I can't find it in current codebase.
WojciechKo
  • 1,511
  • 18
  • 35
3
votes
1 answer

How to use hanami logger?

can you give examples of using hanami logger? I found some controversial Examples, some says it is already inside hanami(and you can use just logger.info('test'), unfortunately at least for me it is not working, I only see config for logger inside…
3
votes
1 answer

gem install bson fail on Windows 10

I'm trying to make a ruby hanami api using mongoid but the instalation fails because of bson. I get this error compiling bytebuf.c compiling endian.c In file included from endian.c:18: bson-endian.h:109:1: error: unknown type name…
3
votes
3 answers

Best practice of error handling on controller and interactor

# users_show_controller.rb class Controllers::Users::Show include Hanami::Action params do required(:id).filled(:str?) end def call(params) result = users_show_interactor(id: params[:id]) halt 404 if result.failure? @user…
3
votes
1 answer

How to create production database in hanami?

Hanami has some commands to create a database. But both db create and db prepare are not available in production environment. http://hanamirb.org/guides/command-line/database/ How can I create a database in production?
3
votes
2 answers

How can I access more than one database with Hanami/Repository

I have a application that has to generate reports from a data warehouse. I don't want to save the app specific data (user, permissions, report defintions, ...) in the same database where the warehouse lives. Also, in the future it is very likely…
Shimu
  • 1,137
  • 11
  • 25
3
votes
1 answer

Choosing where to put validations?

Consider this snippet from the "Getting Started" guide: module Web::Controllers::Books class Create include Web::Action expose :book params do param :book do param :title, presence: true param :author,…
Jonah
  • 15,806
  • 22
  • 87
  • 161
2
votes
0 answers

How to output Hanami::Action::Rack#request_id in reqest log

I want to output Hanami::Action::Rack#request_id in reqest log. Because it is to combine multiple logs in one request. Is there a way to do that ?
Yuji Tamai
  • 21
  • 2
2
votes
0 answers

Hanami: Does the form helper autofill nested colllections?

According to the guides the Hanami form helper automatically fills fields with the right value, even for nested fields. Is this also true for nested collections? It’s not currently working for me, this is the rough structure of my params: { user:…
Danny Santos
  • 1,090
  • 2
  • 10
  • 30
1
2 3 4 5 6