We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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, :response def initialize(request, response) @request = request @response = response end def respond_with(opts) @responds_with ||= {} @responds_with.merge!(opts) end def self.descendants ObjectSpace.each_object(Class).select { |klass| klass < self } end end
class RodaController attr_reader :request, :response
def initialize(request, response) @request = request @response = response end
def respond_with(opts) @responds_with ||= {} @responds_with.merge!(opts) end
def 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" end def show(user_id) "User Show ##{user_id}" end end
class UsersController < RodaController def index "User Index" end
def 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
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.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
I have cloned https://github.com/jeremyevans/roda-sequel-stack
and added roda_controller.rb at project root with the following code:
I have also created a ./controllers/users_controller.rb with the following code:
I have added to my app.rb:
When starting 'rackup' I get:
Error: FrozenError: can't modify frozen String: "UsersController"
Any help would be appreciated.
The text was updated successfully, but these errors were encountered: