OSDN Git Service

t#31566:add form sb
[pettanr/pettanr.git] / app / models / speech_balloon.rb
index a16dc95..1e2deb3 100644 (file)
@@ -28,6 +28,7 @@ class SpeechBalloon < ActiveRecord::Base
       self.t = self.panel.new_t 
       self.z = self.panel.new_z 
     end
+self.classname = 'SpeechBalloon'
   end
   
   def overwrite pid
@@ -125,13 +126,13 @@ class SpeechBalloon < ActiveRecord::Base
     {:include => {:panel => {:include => {:author => {} }}, :balloon => {}, :speech => {}, :speech_balloon_template => {} }}
   end
   
-  def store au
+  def store au, attr
     if self.new_record?
-      self.panel.speech_balloons.build(self.attributes)
+      sb = self.panel.speech_balloons.build
+      sb.attributes = attr
     else
       self.panel.speech_balloons.each do |speech_balloon|
         next unless speech_balloon == self
-        attr = self.attributes
         attr.delete 'id'
         speech_balloon.attributes = attr
         break