grosser / translated_attributes

AR/Rails translatable attributes through virtual fields
9 stars 2 forks source link

store_translated_attributes should return true to have changes after_save #1

Closed markrambow closed 13 years ago

markrambow commented 13 years ago
def store_translated_attributes
  return true unless @translated_attributes_changed
  translations.delete_all
  @translated_attributes.each do |locale, attributes|
    attributes.each do |attribute, value|
      next if value.blank?
      next unless self.class.translated_attributes_options[:fields].include? attribute.to_sym
      translations.create!(:attribute=>attribute, :text=>value, :language=>locale)
    end
  end
  @translated_attributes_changed = false
  true   #     <===== would fix it
end
grosser commented 13 years ago

FYI: returning false cancels all further callbacks, but does not rollback the change fixed in 0.6.0