#4 √ resolved
Aitor Garay-Romero

observe_locales around filter should yield even if globalize is disabled

Reported by Aitor Garay-Romero | August 4th, 2008 @ 11:22 PM | in Rails 2.1.x

If the globalize?() method returns false and disables globalize, the rendering of the action is aborted with the log message:

Filter chain halted as [#] did_not_yield.

since observe_locales() returns without yielding (and Rails aborts the action).

A simple solution is to yield always:

Index: vendor/plugins/click-to-globalize/lib/click_to_globalize.rb

===================================================================

--- vendor/plugins/click-to-globalize/lib/click_to_globalize.rb (revision 810)

+++ vendor/plugins/click-to-globalize/lib/click_to_globalize.rb (working copy)

@@ -203,7 +203,10 @@

  1. request is processed.
  2. LocaleObserver catches all translations and pass them to the session.

def observe_locales

  • return unless globalize?
  • unless globalize?
  • yield
  • return
  • end

locale_observer = LocaleObserver.new

Locale.add_observer(locale_observer)

yield

Comments and changes to this ticket

  • Aitor Garay-Romero

    Aitor Garay-Romero August 4th, 2008 @ 11:24 PM

    Let's see if the formating is better...

    
    

    Index: vendor/plugins/click-to-globalize/lib/click_to_globalize.rb

    ===================================================================

    --- vendor/plugins/click-to-globalize/lib/click_to_globalize.rb (revision 810)

    +++ vendor/plugins/click-to-globalize/lib/click_to_globalize.rb (working copy)

    @@ -203,7 +203,10 @@

    1. request is processed.
    2. LocaleObserver catches all translations and pass them to the session.

    def observe_locales

    • return unless globalize?
    • unless globalize?
    • yield
    • return
    • end

    locale_observer = LocaleObserver.new

    Locale.add_observer(locale_observer)

    yield

  • Aitor Garay-Romero
  • jodosha

    jodosha August 5th, 2008 @ 10:59 AM

    • → Milestone changed from “” to “Rails 2.1.x”
    • → Tag changed from “” to “bug filter”
    • → State changed from “new” to “open”
  • jodosha

    jodosha August 5th, 2008 @ 11:02 AM

    • → State changed from “open” to “resolved”

    (from [e19f1c8aa9eb176afe6cbc3c14a02e8c001749c7]) Make sure observe_locales filter always yield the action even if #globalize? return false [#4 state:resolved]

    http://github.com/jodosha/click-...

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Click to Globalize is an extension for Globalize plugin, it allows to edit in place globalized labels. With this plugin you don't have to create a
globalization back-end, but just edit your interface in place!!

People watching this ticket

Tags