Class: Globalize::ActiveRecord::Translation
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Globalize::ActiveRecord::Translation
- Defined in:
- lib/globalize/active_record/translation.rb
Class Method Summary collapse
- .translated_locales ⇒ Object
- .with_locales(*locales) ⇒ Object (also: with_locale)
Instance Method Summary collapse
Class Method Details
.translated_locales ⇒ Object
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
#locale ⇒ Object
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 |