X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fmodels%2Fpanel_picture.rb;h=8aa6809e1f6111c20bdce4f1a3d3ad033864ee37;hb=eb5aee94f87dd1a2c7ee7a5a6a0e88ae3e235166;hp=de574a7dc436a5de01c25f7736897a896c10a5eb;hpb=01bd644358713f599c11908152f12b911593b190;p=pettanr%2Fpettanr.git diff --git a/app/models/panel_picture.rb b/app/models/panel_picture.rb index de574a7d..8aa6809e 100644 --- a/app/models/panel_picture.rb +++ b/app/models/panel_picture.rb @@ -186,6 +186,14 @@ class PanelPicture < ActiveRecord::Base Kaminari.paginate_array(Array.new(PanelPicture.where(self.himlist_where(au)).includes(PanelPicture.list_opt).count, nil)).page(page).per(page_size) end + def self.list_by_panel_where panel_id + ['panel_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('panel_pictures.updated_at desc').offset((page -1) * page_size).limit(page_size) + end + def self.list_opt {:panel => {:author => {}}, :picture => {:artist => {}, :license => {}} } end