Sha256: 5966270def7668b71bd984ee560d571ef3bfcf69f51c37c32cc3ae625c3d9e1b

Contents?: true

Size: 533 Bytes

Versions: 11

Compression:

Stored size: 533 Bytes

Contents

module Locomotive
  module Concerns
    module RedirectToMainHostController

      extend ActiveSupport::Concern

      included do

        before_filter :redirect_to_main_host

      end

      private

      def redirect_to_main_host
        return if Locomotive.config.host.blank?

        if request.host != Locomotive.config.host
          options = { host: Locomotive.config.host }
          options[:port] = request.port if request.port != 80

          redirect_to root_url(options)
        end
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
locomotivecms-3.1.2 app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb
locomotivecms-3.2.1 app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb
locomotivecms-3.2.0 app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb
locomotivecms-3.2.0.rc2 app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb
locomotivecms-3.2.0.rc1 app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb
locomotivecms-3.1.1 app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb
locomotivecms-3.1.0 app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb
locomotivecms-3.1.0.rc3 app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb
locomotivecms-3.1.0.rc2 app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb
locomotivecms-3.1.0.rc1 app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb
locomotivecms-3.0.1 app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb