Class: Lit::Locale

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

Instance Method Summary collapse

Instance Method Details

#get_all_localizations_countObject



34
35
36
# File 'app/models/lit/locale.rb', line 34

def get_all_localizations_count
  self.localizations.count(:id)
end

#get_changed_localizations_countObject



30
31
32
# File 'app/models/lit/locale.rb', line 30

def get_changed_localizations_count
  self.localizations.changed.count(:id)
end

#get_translated_percentageObject



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

#localeObject

ACCESSIBLE



12
13
14
# File 'app/models/lit/locale.rb', line 12

validates :locale,
:presence=>true,
:uniqueness=>true

#localizationsObject

ASSOCIATIONS



9
# File 'app/models/lit/locale.rb', line 9

has_many :localizations, :dependent=>:destroy

#orderedObject

SCOPES



5
# File 'app/models/lit/locale.rb', line 5

scope :ordered, proc{ order('locale ASC') }

#to_sObject



21
22
23
# File 'app/models/lit/locale.rb', line 21

def to_s
  self.locale
end