OSDN Git Service

t#31687:fiix remove_element
[pettanr/pettanr.git] / app / models / speech_balloon.rb
index ff6716d..d8e6e31 100644 (file)
@@ -165,22 +165,7 @@ class SpeechBalloon < ActiveRecord::Base
   end
   
   def remove au
-    d = false
-    speech_balloons_attributes = {}
-    self.panel.speech_balloons.each do |speech_balloon|
-      attr = speech_balloon.attributes
-      if speech_balloon == self
-        attr['_destroy'] = true
-        d = true
-      else
-        if d
-          attr['t']  -= 1 
-        end
-      end
-      speech_balloons_attributes[speech_balloon.id] = attr
-    end
-    self.panel.attributes = {:speech_balloons_attributes => speech_balloons_attributes}
-    self.panel.store({}, au)
+    self.panel.remove_element(self, au)
   end
   
   def scenario