Hi!
I write a gem at the moment. The Gem need to register during the process in the rack middleware. So I make an folder "rack" inside my "lib" folder. I called the file "request.rb" because it keeps track of requests.
So we speaking about the file /lib/rack/request.rb
But even if I place an empty file on this, I get the following:
/Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/actionpack-3.0.0.beta3/lib/ action_dispatch/http/request.rb:10:in `<module:ActionDispatch>': uninitialized constant Rack::Request (NameError) from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ actionpack-3.0.0.beta3/lib/action_dispatch/http/request.rb:9:in `<top (required)>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ actionpack-3.0.0.beta3/lib/action_controller/metal/rack_delegation.rb: 1:in `<top (required)>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ actionpack-3.0.0.beta3/lib/action_controller/metal/redirecting.rb: 14:in `<module:Redirecting>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ actionpack-3.0.0.beta3/lib/action_controller/metal/redirecting.rb: 10:in `<module:ActionController>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ actionpack-3.0.0.beta3/lib/action_controller/metal/redirecting.rb:1:in `<top (required)>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ actionpack-3.0.0.beta3/lib/action_controller/base.rb:20:in `<class:Base>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ actionpack-3.0.0.beta3/lib/action_controller/base.rb:2:in `<module:ActionController>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ actionpack-3.0.0.beta3/lib/action_controller/base.rb:1:in `<top (required)>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/buddy-0.1.0/lib/ buddy/rails/controller_extensions.rb:2:in `<module:ActionController>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/buddy-0.1.0/lib/ buddy/rails/controller_extensions.rb:1:in `<top (required)>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/buddy-0.1.0/lib/ buddy.rb:63:in `require' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/buddy-0.1.0/lib/ buddy.rb:63:in `<top (required)>' from /Users/kb1/code/rails/gemtestapp/.bundle/environment.rb: 286:in `require' from /Users/kb1/code/rails/gemtestapp/.bundle/environment.rb: 286:in `block (2 levels) in require' from /Users/kb1/code/rails/gemtestapp/.bundle/environment.rb: 281:in `each' from /Users/kb1/code/rails/gemtestapp/.bundle/environment.rb: 281:in `block in require' from /Users/kb1/code/rails/gemtestapp/.bundle/environment.rb: 280:in `each' from /Users/kb1/code/rails/gemtestapp/.bundle/environment.rb: 280:in `require' from /Users/kb1/code/rails/gemtestapp/config/application.rb: 7:in `<top (required)>' from /Users/kb1/code/rails/gemtestapp/config/environment.rb: 2:in `require' from /Users/kb1/code/rails/gemtestapp/config/environment.rb: 2:in `<top (required)>' from /Users/kb1/code/rails/gemtestapp/config.ru:3:in `require' from /Users/kb1/code/rails/gemtestapp/config.ru:3:in `block in <main>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/rack-1.1.0/lib/ rack/builder.rb:46:in `instance_eval' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/rack-1.1.0/lib/ rack/builder.rb:46:in `initialize' from /Users/kb1/code/rails/gemtestapp/config.ru:1:in `new' from /Users/kb1/code/rails/gemtestapp/config.ru:1:in `<main>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/ rack/adapter/loader.rb:36:in `eval' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/ rack/adapter/loader.rb:36:in `load' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/ rack/adapter/loader.rb:45:in `for' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/ thin/controllers/controller.rb:163:in `load_adapter' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/ thin/controllers/controller.rb:67:in `start' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/ thin/runner.rb:177:in `run_command' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/ thin/runner.rb:143:in `run!' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/bin/ thin:6:in `<top (required)>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/bin/thin:19:in `load' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/bin/thin:19:in `<main>'
If I make my Content in this file, which is like: module Rack; module Request; .. I get:
Using rack adapter
/Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/actionpack-3.0.0.beta3/lib/ action_dispatch/http/request.rb:10:in `<module:ActionDispatch>': wrong argument type Module (expected Class) (TypeError) from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ actionpack-3.0.0.beta3/lib/action_dispatch/http/request.rb:9:in `<top (required)>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ activesupport-3.0.0.beta3/lib/active_support/dependencies.rb:209:in `require' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ activesupport-3.0.0.beta3/lib/active_support/dependencies.rb:209:in `block in require' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ activesupport-3.0.0.beta3/lib/active_support/dependencies.rb:195:in `block in load_dependency' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ activesupport-3.0.0.beta3/lib/active_support/dependencies.rb:523:in `new_constants_in' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ activesupport-3.0.0.beta3/lib/active_support/dependencies.rb:195:in `load_dependency' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ activesupport-3.0.0.beta3/lib/active_support/dependencies.rb:209:in `require' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ actionpack-3.0.0.beta3/lib/action_controller/metal/rack_delegation.rb: 1:in `<top (required)>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ actionpack-3.0.0.beta3/lib/action_controller/metal/redirecting.rb: 14:in `<module:Redirecting>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ actionpack-3.0.0.beta3/lib/action_controller/metal/redirecting.rb: 10:in `<module:ActionController>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ actionpack-3.0.0.beta3/lib/action_controller/metal/redirecting.rb:1:in `<top (required)>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ actionpack-3.0.0.beta3/lib/action_controller/base.rb:20:in `<class:Base>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ actionpack-3.0.0.beta3/lib/action_controller/base.rb:2:in `<module:ActionController>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/ actionpack-3.0.0.beta3/lib/action_controller/base.rb:1:in `<top (required)>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/buddy-0.1.0/lib/ buddy/rails/controller_extensions.rb:2:in `<module:ActionController>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/buddy-0.1.0/lib/ buddy/rails/controller_extensions.rb:1:in `<top (required)>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/buddy-0.1.0/lib/ buddy.rb:63:in `require' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/buddy-0.1.0/lib/ buddy.rb:63:in `<top (required)>' from /Users/kb1/code/rails/gemtestapp/.bundle/environment.rb: 286:in `require' from /Users/kb1/code/rails/gemtestapp/.bundle/environment.rb: 286:in `block (2 levels) in require' from /Users/kb1/code/rails/gemtestapp/.bundle/environment.rb: 281:in `each' from /Users/kb1/code/rails/gemtestapp/.bundle/environment.rb: 281:in `block in require' from /Users/kb1/code/rails/gemtestapp/.bundle/environment.rb: 280:in `each' from /Users/kb1/code/rails/gemtestapp/.bundle/environment.rb: 280:in `require' from /Users/kb1/code/rails/gemtestapp/config/application.rb: 7:in `<top (required)>' from /Users/kb1/code/rails/gemtestapp/config/environment.rb: 2:in `require' from /Users/kb1/code/rails/gemtestapp/config/environment.rb: 2:in `<top (required)>' from /Users/kb1/code/rails/gemtestapp/config.ru:3:in `require' from /Users/kb1/code/rails/gemtestapp/config.ru:3:in `block in <main>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/rack-1.1.0/lib/ rack/builder.rb:46:in `instance_eval' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/rack-1.1.0/lib/ rack/builder.rb:46:in `initialize' from /Users/kb1/code/rails/gemtestapp/config.ru:1:in `new' from /Users/kb1/code/rails/gemtestapp/config.ru:1:in `<main>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/ rack/adapter/loader.rb:36:in `eval' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/ rack/adapter/loader.rb:36:in `load' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/ rack/adapter/loader.rb:45:in `for' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/ thin/controllers/controller.rb:163:in `load_adapter' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/ thin/controllers/controller.rb:67:in `start' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/ thin/runner.rb:177:in `run_command' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/ thin/runner.rb:143:in `run!' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/bin/ thin:6:in `<top (required)>' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/bin/thin:19:in `load' from /Users/kb1/.rvm/gems/ruby-1.9.2-head/bin/thin:19:in `<main>'
It seems like something does require a module Rack; class Request; inside of this file. What is the cause of this? Where can I find ressources concerning this issue?
This works perfectly find, if I put this file under:
Greetings form Germany, Klaus