Class: Globalize::ActiveRecord::Translation

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/globalize/active_record/translation.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.translated_localesObject



10
11
12
# File 'lib/globalize/active_record/translation.rb', line 10

def translated_locales
  select('DISTINCT locale').map(&:locale)
end

.with_locales(*locales) ⇒ Object Also known as: with_locale



5
6
7
# File 'lib/globalize/active_record/translation.rb', line 5

def with_locales(*locales)
  where(:locale => locales.flatten.map(&:to_s))
end

Instance Method Details

#localeObject



15
16
17
# File 'lib/globalize/active_record/translation.rb', line 15

def locale
  read_attribute(:locale).to_sym
end

#locale=(locale) ⇒ Object



19
20
21
# File 'lib/globalize/active_record/translation.rb', line 19

def locale=(locale)
  write_attribute(:locale, locale.to_s)
end