From 77ef83508a24bef9d363e47ff0ce583d3ffe89a4 Mon Sep 17 00:00:00 2001 From: Godwin Date: Sat, 20 May 2017 08:15:10 -0700 Subject: [PATCH] Fixed loale links --- app/helpers/i18n_helper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/i18n_helper.rb b/app/helpers/i18n_helper.rb index 62777d5..5e94063 100644 --- a/app/helpers/i18n_helper.rb +++ b/app/helpers/i18n_helper.rb @@ -2,18 +2,18 @@ module I18nHelper def url_for_locale(locale, url = nil) return url unless locale.present? - url ||= current_path + url ||= current_path(true) return url if Rails.env.development? || Rails.env.test? return "https://preview-#{locale.to_s}.bikebike.org#{url}" if Rails.env.preview? "https://#{locale.to_s}.bikebike.org#{url}" end - def current_path + def current_path(relative = false) new_params = params.merge({action: (params[:_original_action] || params[:action])}) new_params.delete(:_original_action) - if Rails.env.development? || Rails.env.test? + if relative || Rails.env.development? || Rails.env.test? return url_for(new_params.merge({lang: locale.to_s})) end