OSDN Git Service

t#32471:add profiles
[pettanr/pettanr.git] / app / models / ground_color.rb
index 5204a02..2f61ce1 100644 (file)
@@ -183,6 +183,14 @@ class GroundColor < ActiveRecord::Base
     Kaminari.paginate_array(Array.new(GroundColor.where(self.himlist_where(au)).includes(GroundColor.list_opt).count, nil)).page(page).per(page_size)
   end
   
+  def self.list_by_panel_where panel_id
+    ['ground_colors.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_colors.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
   def self.list_opt
     {:panel => {:author => {}} }
   end