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



37
38
39
# File 'app/models/lit/locale.rb', line 37

def get_all_localizations_count
  localizations.count(:id)
end

#get_changed_localizations_countObject



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

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

#get_translated_percentageObject



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

#localeObject

ACCESSIBLE



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

validates :locale,
presence: true,
uniqueness: true

#localizationsObject

ASSOCIATIONS



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

has_many :localizations, dependent: :destroy

#orderedObject

SCOPES



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

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

#to_sObject



24
25
26
# File 'app/models/lit/locale.rb', line 24

def to_s
  locale
end