Sha256: f4fca828a3df90a9e828747df0878a85b2b24355a65ffdc3c311ad1dc10dbc89
Contents?: true
Size: 669 Bytes
Versions: 1
Compression:
Stored size: 669 Bytes
Contents
# frozen_string_literal: true require 'rails_with_relative_url_root/version' require 'rack/rewrite' class RailsWithRelativeUrlRoot def self.application Rack::Builder.app do relative_url_root = Rails.application.config.relative_url_root if relative_url_root.present? use Rack::Rewrite do r301 '/', relative_url_root if File.exists?(File.join(Rails.root, 'public', 'robots.txt')) rewrite '/robots.txt', relative_url_root + '/robots.txt' end end map relative_url_root do run Rails.application end else run Rails.application end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_with_relative_url_root-0.1.0 | lib/rails_with_relative_url_root.rb |