rails tag v2.2.0 and globalize2

2 views
Skip to first unread message

Philipp Schmid

unread,
Oct 26, 2008, 4:23:53 PM10/26/08
to rails-i18n
hi,

I'm trying to get globalize2 with the rails v2.2.0 tag to work, but
get the following error.

Is this a known problem (it worked with an older rails edge version)
or is it related to our code?

/Users/schmidp/Development/Netmonic/manager/vendor/plugins/globalize2/
lib/globalize/backend/static.rb:31:in `interpolate': You have a nil
object when you didn't expect it! (NoMethodError)
You might have expected an instance of Array.
The error occurred while evaluating nil.replace from /Users/schmidp/
Development/Netmonic/manager/vendor/rails/activesupport/lib/
active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:41:in
`translate'
from /Users/schmidp/Development/Netmonic/manager/vendor/plugins/
globalize2/lib/globalize/backend/static.rb:16:in `translate'
from /Users/schmidp/Development/Netmonic/manager/vendor/plugins/
globalize2/lib/globalize/backend/static.rb:14:in `each'
from /Users/schmidp/Development/Netmonic/manager/vendor/plugins/
globalize2/lib/globalize/backend/static.rb:14:in `translate'
from /Users/schmidp/Development/Netmonic/manager/vendor/rails/
activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb:153:in
`translate'
from /Users/schmidp/Development/Netmonic/manager/vendor/rails/
activesupport/lib/active_support/core_ext/array/conversions.rb:14:in
`to_sentence'
from /Users/schmidp/Development/Netmonic/manager/app/shared_models/
billing/contract.rb:20
from /Users/schmidp/Development/Netmonic/manager/vendor/rails/
activesupport/lib/active_support/dependencies.rb:368:in
`load_without_new_constant_marking'
... 66 levels...
from /Users/schmidp/Development/Netmonic/manager/vendor/rails/
railties/lib/commands/server.rb:49
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
`require'
from script/server:3
Fast:manager schmidp$

lg Philipp

Lewis Hoffman

unread,
Dec 12, 2008, 1:59:19 PM12/12/08
to rails-i18n
I've run into this problem as well. I traced to to the following
entry in
activesupport-2.2.2/lib/active_support/locale/en.yml:

# Used in array.to_sentence.
support:
array:
sentence_connector: "and"
skip_last_comma: false

It seems some combination of rails2.2 and globalize2 can't handle the
false.
I worked around it by defining support.array.skip_last_comma to be a
string in my application locale files. Of course, this isn't correct
because it will evaluate as true now, but it hasn't caused me problems
yet and gets me past the error.

Lewis


On Oct 26, 2:23 pm, Philipp Schmid <philipp.sch...@gmail.com> wrote:
> hi,
>
> I'm trying to getglobalize2with the rails v2.2.0 tag to work, but
> get the following error.
>
> Is this a known problem (it worked with an older rails edge version)
> or is it related to our code?
>
> /Users/schmidp/Development/Netmonic/manager/vendor/plugins/globalize2/
> lib/globalize/backend/static.rb:31:in `interpolate': You have a nil
> object when you didn't expect it! (NoMethodError)
> You might have expected an instance of Array.
> The error occurred while evaluating nil.replace from /Users/schmidp/
> Development/Netmonic/manager/vendor/rails/activesupport/lib/
> active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:41:in
> `translate'
>         from /Users/schmidp/Development/Netmonic/manager/vendor/plugins/globalize2/lib/globalize/backend/static.rb:16:in `translate'
>         from /Users/schmidp/Development/Netmonic/manager/vendor/plugins/globalize2/lib/globalize/backend/static.rb:14:in `each'
>         from /Users/schmidp/Development/Netmonic/manager/vendor/plugins/globalize2/lib/globalize/backend/static.rb:14:in `translate'
Reply all
Reply to author
Forward
0 new messages