Skip to content

Instantly share code, notes, and snippets.

@moonpolysoft
Created December 8, 2008 23:45
Show Gist options
  • Save moonpolysoft/33686 to your computer and use it in GitHub Desktop.
Save moonpolysoft/33686 to your computer and use it in GitHub Desktop.
class ScriptNameFix
def call(app)
class << app
def new_call(env)
env["SCRIPT_NAME"] = ""
original_call(env)
end
alias_method :original_call, :call
alias_method :call, :new_call
end
app
end
end
def get_options
ObjectSpace.each_object(Thin::Runner) {|runner| return runner.options}
end
options = get_options
puts options.inspect
rails_app = Rack::Adapter::Rails.new(options)
require "#{RAILS_ROOT}/lib/query_handler.rb"
run ScriptNameFix.new
map "/" do
use Rack::Lint
run rails_app
end
map "/query" do
use Rack::Lint
run QueryHandler.new
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment