Sha256: 76bddd4ead84f42d23a564eb385c428594d571760bd37d1f679a79aa12316c28
Contents?: true
Size: 658 Bytes
Versions: 3
Compression:
Stored size: 658 Bytes
Contents
class Product::ClassifiedAdvertisement::Story < Story has_many :tasks, dependent: :destroy, class_name: 'Product::ClassifiedAdvertisement::Task', inverse_of: :story def tasks_attributes=(attributes) self.tasks ||= [] attributes.each do |index, task_attributes| destroy = task_attributes.delete :_destroy if task_attributes[:id].present? && destroy.to_i == 1 self.tasks.where(id: task_attributes[:id]).destroy_all elsif task_attributes[:id].present? tasks.find(task_attributes[:id]).update_attributes(task_attributes) else self.tasks.build(task_attributes) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems