Module: Perfectline::T9n::Models::Translation::ClassMethods
- Defined in:
- lib/t9n/models/translation.rb
Instance Method Summary collapse
Instance Method Details
#available_locales ⇒ Object
55 56 57 |
# File 'lib/t9n/models/translation.rb', line 55 def available_locales find(:all, :select => "DISTINCT locale", :order => :locale).map(&:locale) end |
#cache_key(locale, key, object) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/t9n/models/translation.rb', line 63 def cache_key(locale, key, object) if object.nil? return "#{locale}:#{key}" else return "#{locale}:#{key}:#{object.class.name}_#{object.id}" end end |
#lookup(key) ⇒ Object
59 60 61 |
# File 'lib/t9n/models/translation.rb', line 59 def lookup(key) translated.find(:all, :conditions => ["key = ? OR key ILIKE ?", key, "#{key}.%"], :order => :key) end |