user3579220
user3579220

Reputation: 187

Error: "uninitialized constant Object::Rack" when using gem rack-throttle in ruby Volt framework

I am trying to throttle malicious from my website by using rack-throttle in the new Volt framework. Here is my code in the compnent/config/initializers/boot.rb file:

Volt.current_app.middleware.use(Rack::Throttle::Minute, max: 60)

Limiting the requests per minute works correctly, but I am getting an error message that says the following:

Uncaught NameError: uninitialized constant Object::Rack

Any help would be much appreciated.

Upvotes: 0

Views: 89

Answers (1)

Ryan
Ryan

Reputation: 956

Did you require 'rack/throttle' first?

Also, for middleware, you want to be sure its only running on the server:

unless RUBY_PLATFORM == 'opal'
  Volt.current_app.middleware.use(Rack::Throttle::Minute, max: 60)
end

Upvotes: 2

Related Questions