OSDN Git Service

t30350#:fix destroy
[pettanr/pettanr.git] / app / models / story.rb
index d67ac9d..b4c609c 100644 (file)
@@ -280,10 +280,13 @@ class Story < ActiveRecord::Base
   end
   
   def destroy_and_shorten
+    res = false
     Story.transaction do
       Story.update_all('t = t - 1', ['comic_id = ? and (t > ?)', self.comic_id, self.t])
       raise ActiveRecord::Rollback unless self.destroy
+      res = true
     end
+    res
   end