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

How to get flash messages to work in Hanami

I'm trying to figure out how to get flash messages to work in Hanami. The only reference to flash messages that I've found in the official docs are about testing, not actually implementing. If I overlooked something, please point me in the right…
Jon Garvin
  • 1,178
  • 9
  • 26
1
vote
1 answer

Hanami validate year less than X

I want to check that a date object I have in a validator.rb file has a year field that is less than the year 10000. required(:my_date_object).maybe( :date?, lt?: '10000-01-01' ) When running system tests, the…
Arnab Datta
  • 5,356
  • 10
  • 41
  • 67
1
vote
1 answer

Setting http status but keep normal view?

How can I set different http status but keep normal view? Currently I have these two lines in my action self.status = 403 self.body = Web::Views::Login::Form.render(exposures) However my problems is that I get complete different page, just gray…
graywolf
  • 7,092
  • 7
  • 53
  • 77
1
vote
1 answer

How to do "bulk insert" with Hanami when I use migration

Recently I have tried using Hanami, Ruby framework. I would like to execute migration with "bulk insert". I checked following issue discussion. Proposal: multi_create method for bulk records #406 But, I don't understand how to call ROM object from…
hiropon
  • 1,675
  • 2
  • 18
  • 41
1
vote
1 answer

Minitest run on hanami 1.0.0 somehow corrupts data in controller

I have a controller: module Web::Controllers::Quiz class Test include Web::Action params QuizValidation def show(thing) thing end def call(params) if request.get? unless…
Dmitry Matveyev
  • 307
  • 1
  • 10
1
vote
1 answer

WEBrick run on hanami 1.0.0 shows errors because of wrong inflection

I generated model with hanami generate model stimulus. Then I fixed "stimuluses" to "stimuli" in the migration file name and inside, the table name. Everytime I load a page I get this error in the server console window: [ROM::Relation[Stimuluses]]…
Dmitry Matveyev
  • 307
  • 1
  • 10
1
vote
1 answer

Hanami parameters whitelisting

Following the hanami docs, in order to block a admin parameter inside an action, I can use the following configuration: params do required(:email).filled required(:address).schema do required(:country).filled end end def call(params) …
Rodrigo Vasconcelos
  • 1,270
  • 2
  • 14
  • 26
1
vote
2 answers

Hanami - How to properly check if a model has been persisted?

I'm a newbie in hanami coming from a rails background, and I would like to know the best practice in verifying that a model has been persisted in a create Action. I created a users/create action that looks like this: class Create include…
Rodrigo Vasconcelos
  • 1,270
  • 2
  • 14
  • 26
1
vote
0 answers

Testing actions wrapped in transaction with rspec

I am using the hanami framework and the rspec lib to test my code and PG database. When I trying to test one action I get following error: PG::InFailedSqlTransaction: ERROR: current transaction is aborted, commands ignored until end of transaction…
dewastator
  • 213
  • 4
  • 13
1
vote
2 answers

How can I add my fonts to hanami app?

I added "selawkl.ttf" font into apps/web/assets/fonts folder. But, I recieved next error after page load: HTTP/1.1 GET 404 127.0.0.1 /fonts/selawkl.ttf How can I add "selawkl" to Hanami app?
synacker
  • 1,722
  • 13
  • 32
1
vote
2 answers

How to set 404 error response format to JSON in Hanami

I'm writing REST API for application with Hanami ruby web framework, and I'm wondering how to set error format to JSON. For example,when 404 error occurred it should return response with body {'message': 'Method not found'}, and Content-Type:…
1
vote
1 answer

How can I import a scss file into another scss using hanami compiler?

I have hanami v1.0.0 application with the folowing tree in apps/web/stylesheets: ├── favicon.ico ├── fonts │   ├── glyphs │   │   ├── winjs-symbols.eot │   │   ├── winjs-symbols.ttf │   │   └── winjs-symbols.woff │   ├── LICENSE.txt │   ├──…
synacker
  • 1,722
  • 13
  • 32
1
vote
0 answers

How can I create a watchman trigger to restart the puma/hanami server

I have created this watchman trigger: watchman -j <<-EOT ["trigger", "/home/gergra/code/essence/essence_backend", { "name": "restart_hanami", "expression": ["anyof", ["match", "*.rb"]], "command": [ "alert 'restarte hanami'", …
Shimu
  • 1,137
  • 11
  • 25
1
vote
1 answer

Stale Asset - Hanami does not update the edited files

I'm using Hanami with sass as preprocessor, but when I make changes in some .scss file and refresh the page the changes don't load, the public/assets/file.css is not updating. For update I have to delete the file... Does anyone know why this…
1
vote
1 answer

generate passwords for all users for a web app

I'm building an app with ruby and hanami, however I think my question is probably not framework dependent. The users of the app will sign in to book an appointment for a meeting. The passwords for the users will be encrypted with bcrypt. My question…
Sebastjan Hribar
  • 396
  • 3
  • 13