Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6162425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:39:07+00:00 2026-05-23T21:39:07+00:00

I can’t seem to use a simple rack middleware with Rails 3.1 (rc4). Is

  • 0

I can’t seem to use a simple rack middleware with Rails 3.1 (rc4). Is something missing? Here’s how I built my app:

$ rails new skel192 -G -O -T

I add this line at the end of Gemfile:

gem 'rack-contrib'

I add these lines to config/application.rb:

require 'rack/contrib'
...
config.middleware.use Rack::NotFound.new('public/404.html')

[NOTE: I’m not really planning to use RackNotFound, I was trying to use the simplest middleware I could think of.]

Then for good measure:

$ bundle install
...
$ bundle update
...

FYI:

$ ruby -v
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
$ rails -v
Rails 3.1.0.rc4

But when I run:

$ rails server
=> Booting WEBrick
=> Rails 3.1.0.rc4 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0.rc4/lib/active_support/inflector/methods.rb:124:in `const_defined?': wrong constant name #<Rack (NameError)
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0.rc4/lib/active_support/inflector/methods.rb:124:in `block in constantize'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0.rc4/lib/active_support/inflector/methods.rb:123:in `each'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0.rc4/lib/active_support/inflector/methods.rb:123:in `constantize'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:527:in `block in initialize'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:549:in `yield'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:549:in `default'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:549:in `[]'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.1.0.rc4/lib/action_dispatch/middleware/stack.rb:24:in `klass'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.1.0.rc4/lib/action_dispatch/middleware/stack.rb:43:in `build'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.1.0.rc4/lib/action_dispatch/middleware/stack.rb:112:in `block in build'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.1.0.rc4/lib/action_dispatch/middleware/stack.rb:112:in `each'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.1.0.rc4/lib/action_dispatch/middleware/stack.rb:112:in `inject'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.1.0.rc4/lib/action_dispatch/middleware/stack.rb:112:in `build'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.0.rc4/lib/rails/engine.rb:429:in `app'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.0.rc4/lib/rails/application/finisher.rb:37:in `block in <module:Finisher>'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:25:in `instance_exec'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:25:in `run'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:50:in `block in run_initializers'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:49:in `each'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:49:in `run_initializers'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.0.rc4/lib/rails/application.rb:96:in `initialize!'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.0.rc4/lib/rails/railtie/configurable.rb:30:in `method_missing'
        from C:/work/tech/external/lb/skel192/config/environment.rb:5:in `<top (required)>'
        from C:/work/tech/external/lb/skel192/config.ru:4:in `require'
        from C:/work/tech/external/lb/skel192/config.ru:4:in `block in <main>'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.3.1/lib/rack/builder.rb:51:in `instance_eval'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.3.1/lib/rack/builder.rb:51:in `initialize'
        from C:/work/tech/external/lb/skel192/config.ru:1:in `new'
        from C:/work/tech/external/lb/skel192/config.ru:1:in `<main>'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.3.1/lib/rack/builder.rb:40:in `eval'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.3.1/lib/rack/builder.rb:40:in `parse_file'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.3.1/lib/rack/server.rb:200:in `app'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.0.rc4/lib/rails/commands/server.rb:46:in `app'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.3.1/lib/rack/server.rb:301:in `wrapped_app'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.3.1/lib/rack/server.rb:252:in `start'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.0.rc4/lib/rails/commands/server.rb:70:in `start'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.0.rc4/lib/rails/commands.rb:54:in `block in <top (required)>'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.0.rc4/lib/rails/commands.rb:49:in `tap'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.0.rc4/lib/rails/commands.rb:49:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

Am I missing something?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T21:39:08+00:00Added an answer on May 23, 2026 at 9:39 pm

    I’m still not sure why Rack::NotFound and other rack-contrib middlewares are failing with Rails 3.1 but I did learn something else:

    Sinatra 1.2.x does not play well with Rails 3.1. Switching to Sinatra 1.3.0.e eliminated some other problems I was experiencing with my own middlewares.

    To install:

    $ [sudo] gem install sinatra --prerelease
    

    Then update your middlewares’ dependencies.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can a LINQ enabled app run on a machine that only has the .NET
Can I get a 'when to use' for these and others? <% %> <%#
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Can anybody shed some light on getDay() in Javascript please. Here datepicker is textbox
Can someone guide me on a possible solution? I don't want to use /bin/cp
I want use html5's new tag to play a wav file (currently only supported
Can i use a Select within a concat in xslt? eg <xsl:for-each select=root/OrderItems/lineitem> <xsl:element
We're building an app, our first using Rails 3, and we're having to build
Can we put functions to determine the condition for our list comprehensions. Here is
Can we use the asterisk character * for a search action in SQL database?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.