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
34 35 36 |
# File 'app/models/lit/locale.rb', line 34 def get_all_localizations_count self.localizations.count(:id) end |
#get_changed_localizations_count ⇒ Object
30 31 32 |
# File 'app/models/lit/locale.rb', line 30 def get_changed_localizations_count self.localizations.changed.count(:id) end |
#get_translated_percentage ⇒ Object
25 26 27 28 |
# File 'app/models/lit/locale.rb', line 25 def get_translated_percentage total = self.get_all_localizations_count total > 0 ? (self.get_changed_localizations_count * 100 / total) : 0 end |
#locale ⇒ Object
ACCESSIBLE
12 13 14 |
# File 'app/models/lit/locale.rb', line 12 validates :locale, :presence=>true, :uniqueness=>true |
#localizations ⇒ Object
ASSOCIATIONS
9 |
# File 'app/models/lit/locale.rb', line 9 has_many :localizations, :dependent=>:destroy |
#ordered ⇒ Object
SCOPES
5 |
# File 'app/models/lit/locale.rb', line 5 scope :ordered, proc{ order('locale ASC') } |
#to_s ⇒ Object
21 22 23 |
# File 'app/models/lit/locale.rb', line 21 def to_s self.locale end |