OSDN Git Service

t#:
[pettanr/pettanr.git] / app / models / scroll_panel.rb
index b628edf..9ff9fc2 100644 (file)
@@ -8,8 +8,8 @@ class ScrollPanel < Pettanr::Content
   validates :author_id, :presence => true, :numericality => true, :existence => {:both => false}
   validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
   
-  def owner_model
-    self.scroll
+  def self.owner_model
+    Scroll
   end
   
   def supply_default
@@ -18,9 +18,9 @@ class ScrollPanel < Pettanr::Content
     self.t = nil
   end
   
-  def overwrite au
-    return false unless au
-    self.author_id = au.id
+  def overwrite operators
+    return false unless operators.author
+    self.author_id = operators.author.id
   end
   
   def visible? operators
@@ -181,15 +181,15 @@ class ScrollPanel < Pettanr::Content
     end
   end
   
-  def allow?
+  def allow? operators
     return nil if self.scroll_id == nil or self.panel_id == nil
-    self.scroll.own?(self.author) and self.panel.usable?(self.author)
+    self.scroll.own?(operators) and self.panel.usable?(operators)
   end
   
-  def store old_t = nil
+  def store operators, old_t = nil
     res = false
     ScrollPanel.transaction do
-      case self.allow?
+      case self.allow? operators
       when true
         self.rotate old_t
       when false