Class: Lit::Locale
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Lit::Locale
- Defined in:
- app/models/lit/locale.rb
Instance Method Summary collapse
- #get_all_localizations_count ⇒ Object
- #get_changed_localizations_count ⇒ Object
- #get_translated_percentage ⇒ Object
-
#locale ⇒ Object
ACCESSIBLE.
-
#localizations ⇒ Object
ASSOCIATIONS.
-
#ordered ⇒ Object
SCOPES.
- #to_s ⇒ Object
Instance Method Details
#get_all_localizations_count ⇒ Object
37 38 39 |
# File 'app/models/lit/locale.rb', line 37 def get_all_localizations_count localizations.count(:id) end |
#get_changed_localizations_count ⇒ Object
33 34 35 |
# File 'app/models/lit/locale.rb', line 33 def get_changed_localizations_count localizations.changed.count(:id) end |
#get_translated_percentage ⇒ Object
28 29 30 31 |
# File 'app/models/lit/locale.rb', line 28 def get_translated_percentage total = get_all_localizations_count total > 0 ? (get_changed_localizations_count * 100 / total) : 0 end |
#locale ⇒ Object
ACCESSIBLE
11 12 13 |
# 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, proc { order('locale ASC') } |
#to_s ⇒ Object
24 25 26 |
# File 'app/models/lit/locale.rb', line 24 def to_s locale end |