Open
Description
I wrote this code my application and I run the bundle exec hanami s
so I got message uninitialized constant Web
.
I think Web
is not initialized when accept_json.rb
is loaded.
Below codes work well.
# apps/web/views/accept_json.rb
module Web
module Views
module AcceptJson
def self.included(view)
view.class_eval do
format :json
end
end
end
end
end
or
# apps/web/application.rb
module Web
class Application < Hanami::Application
configure do
# ...
view.prepare do
require_relative './views/accept_json'
include Web::Views::AcceptJson
end
end
end
end
Metadata
Assignees
Labels
No labels