From aefc294765b6e56a2aba5c9c432c4596ba751c74 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Tue, 8 Mar 2011 15:31:18 +1300 Subject: [PATCH] Call super and then change behaviours if we need to rather than reimplementing the method completely and changing it slightly. --- pages/app/controllers/admin/pages_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pages/app/controllers/admin/pages_controller.rb b/pages/app/controllers/admin/pages_controller.rb index 67e09e67c5..4d1565cbb5 100644 --- a/pages/app/controllers/admin/pages_controller.rb +++ b/pages/app/controllers/admin/pages_controller.rb @@ -19,7 +19,12 @@ def new protected def globalize! - Thread.current[:globalize_locale] = (params[:switch_locale] || (@page.present? && @page.slug.present? && @page.slug.locale) || ::Refinery::I18n.default_frontend_locale) + super + + # Check whether we need to override e.g. on the pages form. + unless params[:switch_locale] or @page.try(:slug).nil? or !@page.persisted? + Thread.current[:globalize_locale] = @page.slug.locale + end end def show_errors_for_reserved_slug(exception)