I found something that fixes my issue, if i use the “namespace:” option when building the Router and specify actions using a string (rather than the class)… like so
...
module MyWeb
module Controllers
module Root
class Index
include Hanami::Action
include Hanami::Action::Session
def call(params)
session[:counter] ||= 0
session[:counter] += 1
puts "CCounter: #{session[:counter]}"
self.body = IndexView.new(nil, exposures).render
end
end
end
end
end
Router = Hanami::Router.new(namespace: MyWeb::Controllers) do
root to: 'root#index'
end
...
I’d like to understand why it does not work as expected when using constants to specify the actions in the router