Skip to content

Instantly share code, notes, and snippets.

@alto
Created November 4, 2011 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alto/1339071 to your computer and use it in GitHub Desktop.
Save alto/1339071 to your computer and use it in GitHub Desktop.
redirect_if_current_locale_not_requested_locale
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