(main purpose of this post is to link this “server error” page of rubygems.org)
The relevant issue in Rails Issue Tracker (3789). AFAICT, there are few ways to “fix” (read: workaround) this:
- Modify the relevant Rack code to handle this crap
- Create additional middleware to intercept (how?) the request (tried, either didn’t work or horribly inefficient)
- Extend rack before it is started
Well, they all sucks. Hopefully someone comes up with actual working solution for this.
Oh, there’re another solutions:
- Use REE 1.8 (really?)
- Use JRuby in 1.8 mode
- Use Rubinius (rbx 2.0 where?) in 1.8 mode
Update: I figured out how to “fix” it. Check it out in Moebooru (requires this).
Steps to be into Rails in subdirectory:
config.ru to understand the subdirectory mapping:
map (ENV['RAILS_RELATIVE_URL_ROOT'] || '/') do
And then start Rails with correct environment variable (example if you use Unicorn):
And that’s it. No need to mess with
routes.rb as I previously thought after searching and experimenting for few hours. Links etc are properly generated with correct prefix. Or at least based on my quick testing.
May or may not work with earlier version(s) as I haven’t bothered to test it anywhere else.