lib/refinerycms-page-images.rb in refinerycms-page-images-1.0.3 vs lib/refinerycms-page-images.rb in refinerycms-page-images-1.0.4
- old
+ new
@@ -13,9 +13,11 @@
has_many :images, :through => :image_pages, :order => 'position ASC'
# accepts_nested_attributes_for MUST come before def images_attributes=
# this is because images_attributes= overrides accepts_nested_attributes_for.
accepts_nested_attributes_for :images, :allow_destroy => false
+ attr_accessible :images_attributes
+
def images_attributes=(data)
ImagePage.delete_all(:page_id => self.id)
(0..(data.length-1)).each do |i|
unless (image_data = data[i.to_s]).nil? or image_data['id'].blank?