Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Cannot use most CLI commands in a Rails app with Hanami slices

Open
#438 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rails, ruby
Domain
cli

Research direction

Start by running the reproduction and tracing the CLI entry point for hanami g slice, especially how it discovers the Hanami app. Compare that behavior with the app defined in config/initializers/load_hanami.rb rather than config/app.rb; done means generating a slice works in this Rails setup without moving the app definition, with regression coverage for the scenario.

Written by the indexing model from the issue text.

Description

bug help wanted

Describe the bug

We are working to incrementally migrate a Rails application to Hanami, gradually replacing an area of the Rails code with its own dedicated slice as we go (taking this post as inspiration and a template). As such, we have Hanami stuff in slices/**/* and config/initializers/load_hanami.rb, but nothing in config/app.rb.

To Reproduce

rails new ibis
cd ibis
bundle add hanami
cat << END_INITIALIZER > config/initializers/load_hanami.rb
require 'hanami'
module IbisHanami
  class App < Hanami::App
    prepare_container { |container| container.autoloader.ignore('app') }
  end
end
Hanami.boot
END_INITIALIZER
mkdir -p slices/osprey
cat << END_SLICE > slices/osprey/my_class.rb
module Osprey
  class MyClass
    def call = 'Hello from slice!'
  end
end
END_SLICE
hanami g slice pigeon # does not generate a new slice, instead gives the usage docs for creating a new Hanami app

Expected behavior

It would be nice if there were a way to use the convenient CLI commands in applications that use hanami, but define their Hanami::App somewhere other than config/app.rb

My environment

  • Ruby version: 3.4
  • OS: I have seen this on both Mac OS and Linux
Dominant language
Ruby
Stars
33
Forks
55
Avg merge
4d 7h
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hanami/hanami-cli

All issues in hanami/hanami-cli

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.