OSDN Git Service

v07
[pettanr/pettanr.git] / app / models / scroll.rb
index b748414..3a50002 100644 (file)
@@ -29,12 +29,14 @@ class Scroll < Peta::Binder
     with_panels.find_index.where(Panel.arel_table[:id].eq panel_id).references(:panel)
   end
   
-  scope :find_play, -> (id) do 
-    with_panels.find_index.where(id: id).references(:scroll_panels)
+  # scope of find_play
+  def self.find_play(id)
+    ScrollPanel.find_play(id)
   end
   
-  scope :find_private_play, -> (id, operators) do 
-    with_panels.find_private(operators).where(self.arel_table[:id].eq id).references(:scroll_panels)
+  # scope of find_private_play
+  def self.find_private_play(id, operators)
+    ScrollPanel.find_private_play(id, operators)
   end
   
   def supply_default