-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Hi,
I have cloned https://github.com/jeremyevans/roda-sequel-stack
and added roda_controller.rb at project root with the following code:
roda_controller.rb
class RodaController
attr_reader :request, :responsedef initialize(request, response)
@request = request
@response = response
enddef respond_with(opts)
@responds_with ||= {}
@responds_with.merge!(opts)
enddef self.descendants
ObjectSpace.each_object(Class).select { |klass| klass < self }
end
end
I have also created a ./controllers/users_controller.rb with the following code:
class UsersController < RodaController
def index
"User Index"
enddef show(user_id)
"User Show ##{user_id}"
end
end
I have added to my app.rb:
configuring the plugin
plugin :controller, inject: ->{ [request, response] }
Dir["controllers/*.rb"].each { |file| require_relative file }
RodaController.descendants.each do |controller|
controller_key = Roda::RodaPlugins::Controller.underscore(controller.name)
controller_proc = -> (req, res) { controller.new(req, res) }register_controller(controller_key, controller_proc)
end
When starting 'rackup' I get:
Error: FrozenError: can't modify frozen String: "UsersController"
Any help would be appreciated.