Module: Globalize::ActiveRecord::InstanceMethods

Defined in:
lib/batch_translations.rb

Instance Method Summary collapse

Instance Method Details

#update_attributes_with_translations(options) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/batch_translations.rb', line 24

def update_attributes_with_translations(options)
  options.each do |key, value|
    if key == "translations_attributes"
      translated_attrs = {}
      value.each do |rec_id, rec_value|
        rec_value.delete("id")
        translated_attrs[rec_value.delete("locale")] = rec_value
      end
      self.set_translations(translated_attrs)
    else
      self.update_attribute(key, value)
    end
  end
end