Steps to be into Rails in subdirectory:
Update config.ru
to understand the subdirectory mapping:
run Moebooru::Application
change to
map (ENV['RAILS_RELATIVE_URL_ROOT'] || '/') do run Moebooru::Application end
And then start Rails with correct environment variable (example if you use Unicorn):
RAILS_RELATIVE_URL_ROOT='/img' bin/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.