|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Problem with alternative model translationHi all,
I install the latest globalize and is trying out the alternative model translation. I got the following nil error and i am not sure what i am doing wrong, it seems to happen only to that particular 'artist' field. if i execute i.name, it works for different laguages.
Hope you all can help me. I looked at the db_translate.rb in globalize but that is too advanced for me as I am new to rails.
thanks
Foong ======== Console Output follows ===========
Loading development environment.
>> i = Item.find(10)
=> #<Item:0x1ffd344 @attributes={"artist"=>"Denisa", "name"=>"Hottie", "supplierId"=>"1", "mcps"=>"", "typeId"=>"7", "name_sv"=>nil, "isrc"=>"", "id"=>"10", "name_es"=>"Spanish Nane", "artist_sv"=>nil, "artist_es"=>"Span Artish", "created_at"=>"2008-02-21 17:03:14", "file"=>"Denisa_BrownSwimsuit"}>
>> i.artist
=> "Denisa"
>> Locale.set('es-ES')
=> #<Globalize::Locale:0x1ff66c0 @decimal_sep=",", @date_format=nil, @thousands_sep=".", @language=Spanish, @number_grouping_scheme=:western, @currency_code="EUR", @country=#<Globalize::Country:0x1fad358 @attributes={"date_format"=>nil, "currency_decimal_sep"=>",", "thousands_sep"=>".", "code"=>"ES", "number_grouping_scheme"=>"western", "english_name"=>"Spain", "decimal_sep"=>",", "id"=>"66", "currency_code"=>"EUR", "currency_format"=>"%n €"}>, @currency_decimal_sep=",", @currency_format="%n €", @code="es-ES">
>> i.artist
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[]
from (eval):74:in `add_bidi'
from (eval):17:in `artist'
from (irb):4
|
|
|
Re: Problem with alternative model translationHi - The problem is solved. I am not sure this is documented somewhere, you need to do the following in a single line
localize :name, :artist instead of localize :name localize :artist Thanks Foong On Tue, Aug 26, 2008 at 3:49 AM, Chee Foong Chiew <ch33foong@...> wrote:
|
|
|
Re: [Bulk] Re: Problem with alternative model translationHi!
Wondering if any of you know of a good way to migrate an app (rails 2.0.2) using globalize (1) application to a rails 2.3.x? As you know, the globalize (1) plugin is no longer officially supported, and globalize 2 is not compatible with the previous release. I am wondering if any of you have made it work for rails 2.3.x, any github forks, or if you know of any other successful migrations (blog articles, etc.) Thanks much, Jürgen |
| Free embeddable forum powered by Nabble | Forum Help |