Sha256: 33e5771b8d7e62402623d9957184b65e4f2e8d76fca20a4f6ae2147af6dc1330

Contents?: true

Size: 455 Bytes

Versions: 1

Compression:

Stored size: 455 Bytes

Contents

module Harpiya
  module LocaleUrls
    extend ActiveSupport::Concern

    included do
      before_action :redirect_to_default_locale
    end

    private

    def default_url_options
      super.merge(locale: locale_param, currency: currency_param)
    end

    def redirect_to_default_locale
      return if params[:locale].blank? || supported_locale?(params[:locale])

      redirect_to url_for(request.parameters.merge(locale: nil))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
harpiya_frontend-4.3.0.alpha app/controllers/concerns/harpiya/locale_urls.rb