lib/refinerycms-page-images.rb in refinerycms-page-images-0.9.8 vs lib/refinerycms-page-images.rb in refinerycms-page-images-0.9.9
- old
+ new
@@ -15,9 +15,10 @@
# this is because images_attributes= overrides accepts_nested_attributes_for.
accepts_nested_attributes_for :images, :allow_destroy => false
def images_attributes=(data)
self.images.clear
+ data.reject!{|i, d| d['id'].blank?}
self.images += (0..(data.length-1)).collect { |i|
(Image.find(data[i.to_s]['id'].to_i) rescue nil)
}.compact
end
end