Class: RailsDbLocalize::Translation

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/rails_db_localize/translation.rb

Class Method Summary collapse

Class Method Details

.generate_ck(resource_type, resource_id) ⇒ Object



18
19
20
21
# File 'app/models/rails_db_localize/translation.rb', line 18

def self.generate_ck resource_type, resource_id
  #Keep it 32bits.
  [resource_type.to_s.underscore, resource_id].join("|").hash & 0x7fffffff
end

.get_untranslated(model, field, lang) ⇒ Object



23
24
25
26
27
# File 'app/models/rails_db_localize/translation.rb', line 23

def self.get_untranslated model, field, lang
  model.where("id NOT IN (?)",
    [-1, *RailsDbLocalize::Translation.where(resource_type: k.to_s, lang: lang, field: field).pluck(:resource_id).uniq]
  )
end