Class: Ixtlan::Models::Translation

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
lib/ixtlan/models/translation.rb

Constant Summary collapse

TEXT =
Object.full_const_get(Models::TEXT)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_storage_nameObject



7
8
9
# File 'lib/ixtlan/models/translation.rb', line 7

def self.default_storage_name
  "Translation"
end

.map_for(args = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ixtlan/models/translation.rb', line 25

def self.map_for(args = {})
  map = {}
  TEXT.latest_approved(args.dup).each do |text|
    map[text.code] = Translation.create(:text => text.text, :approved_at => text.approved_at, :approved_by => text.approved_by)
  end
  TEXT.second_latest_approved(args.dup).each do |text|
    translation = map[text.code]
    translation.previous_text = text.text
  end
  map
end

Instance Method Details

#to_xObject



37
# File 'lib/ixtlan/models/translation.rb', line 37

alias :to_x :to_xml_document

#to_xml_document(opts = {}, doc = nil) ⇒ Object



38
39
40
41
# File 'lib/ixtlan/models/translation.rb', line 38

def to_xml_document(opts = {}, doc = nil)
  opts.merge!({:exclude => [:id]})
  to_x(opts, doc)
end