Globalize Plugin: SImple question about searching untraslated records

0 views
Skip to first unread message

Gianluca Tessarolo

unread,
Jan 19, 2008, 12:19:17 PM1/19/08
to rubyonra...@googlegroups.com
Hi,

how can i find all record of untranslated field on a field under
Globalize plugin ?

Example:

define a model:

class Translation < ActiveRecord::Base
translates :description
end

working with 2 locales (en-US base and it-IT)

when i create a record for english base locale and after set italian
locale reading the translation of model.description I retrieve the
default value (that's ok because Globalize uses coalesce to return the
engish description if italian description is not present).

What can I do to know which translations is not already loadedin italian
locale ? (sort of Model.find(:all, :conditions => "description is null
or description = ''))

Thanks in advance.


Gianluca Tessarolo

unread,
Jan 19, 2008, 1:36:21 PM1/19/08
to rubyonra...@googlegroups.com
I've solved from myself.

Simply using this condition only when not in base language:

Translation.find(:all, :conditions => "t_description.text is null")

Hope this helps...


--
Gianluca Tessarolo
TreNetMediaMaster S.r.l.
The Internet Technology Company
Telefono +39(049)776196
Fax +39(049)8087806
Visit us @: http://www.trenet.it - http://www.mediamaster.it
e-mail me @: tessarolo...@mediamaster.it
----------------------------------------------------------------------
Le informazioni trasmesse sono destinate esclusivamente alla persona o
alla società in indirizzo e sono da intendersi confidenziali e riservate.
Ogni trasmissione, inoltro, diffusione o altro uso di queste
informazioni a persone o società differenti dal destinatario é proibita.
Se ricevete questa comunicazione per errore, contattate il mittente e
cancellate le informazioni da ogni computer.


Reply all
Reply to author
Forward
0 new messages