# Ruby namespaces in hanami-router 2.0.0

**URL:** <https://discourse.hanakai.org/t/ruby-namespaces-in-hanami-router-2-0-0/708>\
**Category:** questions\
**Created:** [October 7, 2022, 3:12pm UTC](https://discourse.hanakai.org/t/ruby-namespaces-in-hanami-router-2-0-0/708 "2022-10-07T15:12:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jammjammjamm](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.hanakai.org/jammjammjamm/32/556_2.png) [@Jammjammjamm](https://discourse.hanakai.org/u/Jammjammjamm)\
**Post date:** [October 7, 2022, 3:12pm UTC](https://discourse.hanakai.org/t/ruby-namespaces-in-hanami-router-2-0-0/708/1 "2022-10-07T15:12:57Z")

</div>

I have a non-hanami app which uses hanami-controller and router. I’m in the process if upgrading it to use ruby 3, which means I need to update hanami-router from 1.3.2 to one of the 2.0.0 beta versions.

In hanami-router 1.3.2, [you could specify a ruby namespace](https://github.com/hanami/router/tree/f41001d4c3ee9e2d2c7bb142f74b43f8e1d3a265#namespaces) where the router would look for your actions. I don’t see this behavior anymore. Does that mean I have to manually specify every route now?

---

<div class="post-metadata">

**Author:** ![alassek](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.hanakai.org/alassek/32/532_2.png) [@alassek](https://discourse.hanakai.org/u/alassek)\
**Post date:** [October 13, 2022, 6:42pm UTC](https://discourse.hanakai.org/t/ruby-namespaces-in-hanami-router-2-0-0/708/2 "2022-10-13T18:42:29Z")

</div>

This functionality changed a bit in 2.0 but you can still achieve the same result. It’s encapsulated in a route resolver object than can be passed into `Hanami::Router`:

```ruby
# Resolve a route identity to an Action instance.
# Infers the `actions` prefix for container keys to reduce duplication.
class RouteResolver
  include Dry::Initializer.define -> do
    param :container
  end

  def call(_, ident)
    case ident
    when String, Symbol
      String(ident)
        .then { |str| str.start_with?("actions") ? str : "actions.#{str}" }
        .then { |str| container.resolve(str) }
    when Class
      ident.respond_to?(:call) ? ident : ident.new
    else
      ident
    end
  end
end

Hanami::Router.new(resolver: RouteResolver.new(Application))

```
