Class: Lit::Locale
- Defined in:
- app/models/lit/locale.rb
Instance Attribute Summary
Attributes inherited from Base
#retried_created, #retried_updated
Instance Method Summary collapse
- #all_localizations_count ⇒ Object
- #changed_localizations_count ⇒ Object
-
#locale ⇒ Object
VALIDATIONS.
-
#localizations ⇒ Object
ASSOCIATIONS.
-
#ordered ⇒ Object
SCOPES.
- #to_s ⇒ Object
- #translated_percentage ⇒ Object
Methods inherited from Base
#mark_for_retry, #rolledback_after_insert?, #rolledback_after_update?
Instance Method Details
#all_localizations_count ⇒ Object
35 36 37 |
# File 'app/models/lit/locale.rb', line 35 def all_localizations_count localizations.active.count(:id) end |
#changed_localizations_count ⇒ Object
31 32 33 |
# File 'app/models/lit/locale.rb', line 31 def changed_localizations_count localizations.active.changed.count(:id) end |
#locale ⇒ Object
VALIDATIONS
11 |
# File 'app/models/lit/locale.rb', line 11 validates :locale, presence: true, uniqueness: true |
#localizations ⇒ Object
ASSOCIATIONS
8 |
# File 'app/models/lit/locale.rb', line 8 has_many :localizations, dependent: :destroy |
#ordered ⇒ Object
SCOPES
4 |
# File 'app/models/lit/locale.rb', line 4 scope :ordered, -> { order(locale: :asc) } |
#to_s ⇒ Object
22 23 24 |
# File 'app/models/lit/locale.rb', line 22 def to_s locale end |
#translated_percentage ⇒ Object
26 27 28 29 |
# File 'app/models/lit/locale.rb', line 26 def translated_percentage total = all_localizations_count total > 0 ? (changed_localizations_count * 100 / total) : 0 end |