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
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
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