Hanami::Model is a persistence framework for Hanami.
Questions tagged [hanami-model]
15 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
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
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
2 answers
hanami-model integration to ruby project
structure of my application:
.
├── config
│ ├── boot.rb
│ └── environment.rb
├── Gemfile
├── Gemfile.lock
├── lib
│ ├── entities
│ │ └── account.rb
│ └── repositories
│ └── account_repository.rb
└── README.md
Gemfile:
source…

Marsel.V
- 1,015
- 1
- 12
- 28
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
2
votes
2 answers
Database design question regarding performance
I need help with deciding on a DB design approach. We're building a translation tool with Hanami (Ruby web framework) and thus ROM. We are facing the design decision of having one DB (Postgresql) table for translation records, where each record is…

Sebastjan Hribar
- 396
- 3
- 13
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
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
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
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…

Egor Bazhenov
- 11
- 2
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
0
votes
1 answer
Hamani: Entities and Repositories what is the difference?
I continue to study hanami on my own and I ran into the fact that when generating the User model, hanami generates 2 entities and repositories directories that contain files
user.rb in the entities directory
class User <…

DanilNovikov
- 21
- 2
0
votes
0 answers
Error with Hanami has_many associations (in 1.1.0.beta1)
I am using Hanami 1.1.0.beta1 (because I need associations).
An event can have many actions:
class EventRepository < Hanami::Repository
associations do
has_many :actions
...
end
class ActionRepository < Hanami::Repository
associations…

E. Rubin
- 1
- 1
0
votes
2 answers
Less-than queries in a Lotus Model Repository
Is it possible to perform the following query in a Lotus::Model Repository?
def active
query.where("publish_at >= #{Date.today}")
end
In Sequel, which Lotus::Model uses, you can do the above or you can pass it a block like so
where{publish_at >=…

Jamie Wright
- 1,160
- 10
- 23