Created
November 4, 2011 10:39
-
-
Save alto/1339071 to your computer and use it in GitHub Desktop.
redirect_if_current_locale_not_requested_locale
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def redirect_if_current_locale_not_requested_locale | |
if session[:requested_locale].present? && Language::SUPPORTED_LANGUAGES.include?(session[:requested_locale].to_sym) | |
if geo_locator_slug = GeoLocatorSlug.find_by_slug_and_language(params[:locator_slug], session.delete(:requested_locale).to_sym) | |
geo_locator_slug = geo_locator_slug.slug_for_new_language(current_language) | |
redirect_to locator_path(geo_locator_slug.to_param) if geo_locator_slug.present? | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment