MailingList


Problem with alternative model translation

by Chee Foong Chiew :: Rate this Message:

Reply to Author | View in Thread

Hi 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

 « Return to Thread: Problem with alternative model translation