OSDN Git Service

temp
[pettanr/pettanr.git] / app / models / comic.rb
index 0c47010..fbb04e2 100644 (file)
@@ -55,6 +55,14 @@ class Comic < Pettanr::Content
     'comics.updated_at desc'
   end
   
+  def self.list_by_author_where author_id
+    ['comics.author_id = ?', author_id]
+  end
+  
+  def self.list_by_author author_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_author_where(author_id)).includes(self.list_opt).order('comics.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
   def self.list_opt
     {:stories => {}, :author => {} }
   end