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
1
vote
0 answers

Hanami: asset URL helper in stylesheets

I am using Hanami 1.3.5 and sassc 2.4.0. I want to use the an image url helper inside of an Hanami stylesheet (like it's possible in Rails): body background-image: image-url('zipper.svg') but this the image-url doesn't get evaluated. Also naively…
Alexander Presber
  • 6,429
  • 2
  • 37
  • 66
1
vote
2 answers

Which Postgresql index is most efficient for text column with queries based on similarity

I would like to create an index on text column for the following use case. We have a table of Segment with a column content of type text. We perform queries based on the similarity by using pg_trgm. This is used in a translation editor for finding…
Sebastjan Hribar
  • 396
  • 3
  • 13
1
vote
0 answers

Hanami: undefined method `size' for nil:NilClass

I keep learning hanami and ran into the following problem: when I initialize and check the parameters, I encounter the following error Boot Error Something went wrong while loading /Users/anewaccount/Projects/Mediateka/config.ru NoMethodError:…
1
vote
1 answer

How to get a list of all routes used in a Hanami app?

We have a way to get all the routes used in Rails and Sinatra as below Rails: Rails.application.routes.routes Sinatra: Sinatra::Application.routes Similarly, How can we get all the routes used in Hanami app?
Prateek Sen
  • 392
  • 2
  • 9
1
vote
1 answer

Passing session value from one app to the next

I'm setting a session value in one app and it's not available in any other app once the redirect happens. It's available in the source app (the one where the value is set) though. Is this expected behavior? I've inspected session IDs in the origin…
Sebastjan Hribar
  • 396
  • 3
  • 13
1
vote
2 answers

Occurrence of Sequel::DatabaseDisconnectError at puma worker, even though the db is disconnected in puma's before_fork-hook

I have a hanami 1.3 app, but the issue should be unrelated to hanami. I want to connect to a second db with plain Sequel-gem. Therefore I define the connection in hanami's config/environment.rb: # config/environment.rb # ... DWH =…
wuarmin
  • 3,274
  • 3
  • 18
  • 31
1
vote
1 answer

Use a postgres computed value without a column as a Ruby variable

I have a Hanami web application where one feature is to compare strings in the database with a user provided string. To do this, I use the postgres extension pg_trgm. The translated query condition in Ruby looks like this: .where…
Sebastjan Hribar
  • 396
  • 3
  • 13
1
vote
1 answer

How to test WebSockets For Hanami?

Using the following: Hanami cookbook websockets IoT Saga - Part 3 - Websockets! Connecting LiteCable to Hanami I've been able to add WebSockets to Hanami, however as this is for production code I want to add specs; but I can't find information on…
Thermatix
  • 2,757
  • 21
  • 51
1
vote
2 answers

How to use conditions in update/delete commands with Hanami::Repository?

Can't figure out how to update/delete records by conditions with Hanami::Repository. For example, there are these tables: users and clients. Users have: deleted_at column, for marking user as deleted client_id column, as foreign key on clients…
1
vote
1 answer

Hanami rake task does not load repositories

I have hanami 1.3.0 app named booking. There is rake task in /rakelib/motel.rake : require_relative '../lib/booking' # it requires booking/motel/booker file namespace :motel do task :book do Booking::Motel::Booker.new.book …
1
vote
0 answers

HANAMI Reload routes into Rspec Test

Good morning, I have a question. How i can reload my routes into a RSpec Test after change my env variable like i do in rails (Rails.application.reload_routes!) Thank you! Gustavo
1
vote
2 answers

Using Hanami model and rake tasks without a router etc

I'm going to write a service that will using amqp protocol, without http at all. I like hanami's paradigm of repository-entity-model-interactors and I wonder to use those in my project. Generating all that stuff by hand, sure, is boring. So, I…
Dimitri
  • 623
  • 7
  • 14
1
vote
2 answers

How to refactor queries chain in Hanami?

How to refactor #filtered method? In Hanami there is no way to make a chain of queries (filters) in ActiveRecord-style. I would like to get a methods like ActiveRecord filters. Now: documents.filtered(genre: 'news', min_published_at: from,…
foxwwweb
  • 53
  • 4
1
vote
2 answers

How to Transform Emails in Hanami to include inline the styles defined in an external css file?

If I use roadie/premailer to transform my emails in Hanami, then where should I place the transformation code in Hanami? Thx
Boti
  • 3,275
  • 1
  • 29
  • 54
1
vote
1 answer

Rake tests use a different database than Hanami?

I'm getting started with Hanami. (I use a different entity name, I started with reviews, not books, but otherwise I followed the instructions on the linked page.) bundle exec hanami db prepare runs fine. The SQLite database is created. bundle exec…
ytg
  • 1,755
  • 2
  • 23
  • 41