OSDN Git Service

t#29620:json output include child
[pettanr/pettanr.git] / app / models / story.rb
index 46ce75e..f269bba 100644 (file)
@@ -124,6 +124,10 @@ class Story < ActiveRecord::Base
     self.to_json({:include => {:comic => {:include => {:author => {}}}, :author => {}, :panel => panel_include}})
   end
   
+  def self.list_as_json_text ary, au
+    '[' + ary.map {|i| i.story_as_json(au) }.join(',') + ']'
+  end
+  
   def self.new_t comic_id
     r = Story.max_t(comic_id)
     r.blank? ? 0 : r.to_i + 1