OSDN Git Service

t#31687:fiix remove_element
[pettanr/pettanr.git] / app / models / panel_picture.rb
index 57a3a4b..cef80fe 100644 (file)
@@ -200,22 +200,7 @@ class PanelPicture < ActiveRecord::Base
   end
   
   def remove au
-    d = false
-    panel_pictures_attributes = {}
-    self.panel.panel_pictures.each do |panel_picture|
-      attr = panel_picture.attributes
-      if panel_picture == self
-        attr['_destroy'] = true
-        d = true
-      else
-        if d
-          attr['t']  -= 1 
-        end
-      end
-      panel_pictures_attributes[panel_picture.id] = attr
-    end
-    self.panel.attributes = {:panel_pictures_attributes => panel_pictures_attributes}
-    self.panel.store({}, au)
+    self.panel.remove_element(self, au)
   end
   
   def scenario