OSDN Git Service

t#32471:add profiles
[pettanr/pettanr.git] / app / models / ground_picture.rb
index 3740a9f..647bf23 100644 (file)
@@ -155,6 +155,14 @@ class GroundPicture < ActiveRecord::Base
     Kaminari.paginate_array(Array.new(GroundPicture.where(self.himlist_where(au)).includes(GroundPicture.list_opt).count, nil)).page(page).per(page_size)
   end
   
+  def self.list_by_panel_where panel_id
+    ['ground_pictures.panel_id = ?', panel_id]
+  end
+  
+  def self.list_by_panel panel_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_panel_where(panel_id)).includes(self.list_opt).order('ground_pictures.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
   def self.list_opt
     {:panel => {:author => {}}, :picture => {:artist => {}, :license => {}} }
   end