Module: Globalize::ActiveRecord::InstanceMethods

Defined in:
lib/batch_translations.rb

Instance Method Summary collapse

Instance Method Details

#update_attributes_with_translations(attributes) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/batch_translations.rb', line 34

def update_attributes_with_translations(attributes)
  attributes.each do |key, value|
    if key == "translations_attributes"
      value.each do |rec_index, rec_value|
        locale = rec_value.delete("locale")
        write_attribute(rec_value.keys.first, rec_value.values.first, options = { :locale => locale })
      end
    else
      self.update_attribute(key, value)
    end
  end
end