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
2
votes
1 answer

Hanami : access current page URL from views or templates

I'm discovering Hanami those days (Hanami 1.3), I'm polishing the test project I've worked on, and I can't find a way to access the current page url/path from a view or a template (the idea is handling the navigation links visual state, as you may…
Pierre-Adrien
  • 2,836
  • 29
  • 30
2
votes
0 answers

VBS scripting via Ruby web app -- issues with multithreading

I have a very basic Ruby web application (currently in Hanami and in Rails) which provides VBS scripting functionalities to end users. This is currently still on Windows. The end user simply fills in a form and the web app triggers respecitve script…
2
votes
0 answers

How do I include Hanami into the existing Rails app?

Is that possible to use Hanami as a engine in the Rails application? I didn't found any straight-forward way to do this in the docs so far.
alv_721
  • 305
  • 3
  • 18
2
votes
2 answers

Delete record from console in Hanami

In Rails you can do: rails c record = Record.where(name: 'Test Record').first record.destroy How can you do the same in Hanami? I've been reading through the docs but I'm struggling to see how to do console commands like Rails to interact with the…
Cameron
  • 27,963
  • 100
  • 281
  • 483
2
votes
2 answers

How to fetch data from multiple tables with one SQL query in Hanami?

I have Hanami models User and UserInfo that have has_one association. Repositories look the following: class UserInfoRepository < Hanami::Repository end class UserRepository < Hanami::Repository associations do has_one :user_info …
Sergey Potapov
  • 3,819
  • 3
  • 27
  • 46
2
votes
1 answer

How to load Hanami Model in a migration?

I want to change a structure of a table in a table and I need to backfill some new fields with the values of the old ones. So, for that, I want to use the repository in the migration. But, it seems that I need to load Hanami Model to use a…
rafaels88
  • 839
  • 1
  • 6
  • 19
2
votes
1 answer

Have Hanami an alternative for .present?

Rails has useful present? method. How can I check the same in Hanami?
arturtr
  • 1,115
  • 9
  • 18
2
votes
2 answers

Sidekiq can't find worker class on Hanami app

I'm trying to use sidekiq to send emails asynchronously on a Hanami app. This is my worker class: # lib/myapp/workers/async_mailers.rb class AsyncMailer include Sidekiq::Worker def perform(mail_type) ... # send mail ... …
Rodrigo Vasconcelos
  • 1,270
  • 2
  • 14
  • 26
2
votes
2 answers

Hanami routes helper don't work in templates

I have hanami application version 1.0.0 I have next routes.rb file: get '/games', to: 'games#index' root to: 'home#index' I read docs and tried to use <%= routes.games_path %> in application.html.erb template, but recieved next…
synacker
  • 1,722
  • 13
  • 32
2
votes
1 answer

Hanami, show 'post' controller/view

I don't understand Hanami, I've created Message model, and I want to pull from DB message by params[:id]. The way we do it in Rails @message = Message.find(params[:id]. I read documentation, and what I did after. My Controller (for show): def…
Andrey Drozdov
  • 571
  • 1
  • 5
  • 22
2
votes
3 answers

NoMethodError: undefined method for String with custom module in Hanami

I am using Hanami and I created a custom module in /lib/supports/utils.rb. I'm requiring all the files located /lib/supports in /lib/myapp that it's like the following: require 'hanami/model' require…
1
vote
1 answer

Create hanami project?

With hanami 2.0.1 and ruby version 3.0.2... When create hanami new bookshelf.I got this error.. Created bookshelf/ -> Within bookshelf/ Created .env Created README.md Created Gemfile Created Rakefile Created config.ru Created config/app.rb Created…
aaaa
  • 73
  • 1
  • 6
1
vote
1 answer

Inherited Hanami validators

I have Hanami 1.3.3 and two validators there: for create and update actions like these module Validators module MyEntities class Create include Hanami::Validations::Form include Validatable messages :i18n validations…
mechnicov
  • 12,025
  • 4
  • 33
  • 56
1
vote
1 answer

How to get access to Hanami connection instance

Hanami uses Sequel as default ORM There are different plugins for Sequel Sometimes to use it you need to access to database connection object For example to use PostgreSQL advisory locking for mutexes There are such gems for this:…
mechnicov
  • 12,025
  • 4
  • 33
  • 56
1
vote
0 answers

Webpack 5: DevServer does not trigger recompile when files change despite HMR connecting successfully

Webpack version webpack: 5.65.0 webpack-cli: 4.9.1 webpack-dev-server 4.7.1 Hi all, I am pretty new to coding and trying to set up a monolithic application using React on the Frontend and Hanami (a Ruby framework) on the Backend. I wanted to use…