Sha256: 1ecabf818de184477e89623a09a4492ec4f2eb58a6b6beaa37a208ac7858ab45
Contents?: true
Size: 923 Bytes
Versions: 2
Compression:
Stored size: 923 Bytes
Contents
# frozen_string_literal: true raise Parklife::RailsNotDefinedError unless defined?(Rails) module Parklife module RailsConfigRefinements # When setting Parklife's base also configure the Rails app's # default_url_options and relative_url_root to match. def base=(value) super.tap { |uri| Rails.application.default_url_options = { host: Utils.host_with_port(uri), protocol: uri.scheme, } base_path = !uri.path.empty? && uri.path != '/' ? uri.path : nil ActionController::Base.relative_url_root = base_path } end end end Parklife.application.config.app = Rails.application # Allow use of the Rails application's route helpers when defining Parklife # routes in the block form. Parklife.application.routes.singleton_class.include(Rails.application.routes.url_helpers) Parklife.application.config.extend(Parklife::RailsConfigRefinements)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
parklife-0.5.1 | lib/parklife/rails.rb |
parklife-0.5.0 | lib/parklife/rails.rb |