Class: Localization

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/localization.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.localesObject



7
8
9
# File 'app/models/localization.rb', line 7

def locales
  order("locale ASC").pluck(Arel.sql("DISTINCT locale"))
end

.namesObject



11
12
13
# File 'app/models/localization.rb', line 11

def names
  order("name ASC").pluck(Arel.sql("DISTINCT name"))
end

Instance Method Details

#to_sObject



16
17
18
# File 'app/models/localization.rb', line 16

def to_s
  value || ""
end

#translate(locale) ⇒ Object



22
23
24
# File 'app/models/localization.rb', line 22

def translate(locale)
  localizable.localizations.find_by(name: name, locale: locale)
end