OSDN Git Service

fix peta test
[pettanr/pettanr.git] / app / models / sheet_panel.rb
index 15b0798..591b259 100644 (file)
@@ -1,19 +1,18 @@
 class SheetPanel < Peta::Element
   load_manifest
-  belongs_to :author
   belongs_to :panel
   belongs_to :sheet
   accepts_nested_attributes_for :panel, :allow_destroy => true
+  #alias_attribute :attr_y, :y
   
   validates :sheet_id, :numericality => {:allow_blank => true}
   validates :panel_id, :numericality => {:allow_blank => true}
-  validates :author_id, :presence => true, :numericality => true, :existence => {:both => false}
   validates :x, :presence => true, :numericality => true
   validates :y, :presence => true, :numericality => true
   validates :z, :presence => true, :numericality => {:greater_than => 0}
   validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
   
-  def attr_y
+  def y
     self.attributes['y']
   end
   
@@ -31,11 +30,6 @@ class SheetPanel < Peta::Element
     end
   end
   
-  def overwrite operators
-    return false unless operators.author
-    self.author_id = operators.author.id
-  end
-  
   def self.by_author_list_includes
     {
       :sheet => {
@@ -46,7 +40,6 @@ class SheetPanel < Peta::Element
   
   def self.show_opt
     {:include => {
-      :author => {}, 
       :sheet => {
         :author => {}
       }, 
@@ -64,11 +57,11 @@ class SheetPanel < Peta::Element
   
   def sheet_panel_as_json au
     panel_include = if self.panel and self.panel.visible?(au)
-      {:include => {:author => {}}, :methods => :elements}
+      {:include => {}, :methods => :elements}
     else
-      {:include => {:author => {}}}
+      {:include => {}}
     end
-    self.to_json({:include => {:sheet => {:include => {:author => {}}}, :author => {}, :panel => panel_include}})
+    self.to_json({:include => {:sheet => {:include => {:author => {}}}, :panel => panel_include}})
   end
   
   def self.list_as_json_text ary, au