OSDN Git Service

temp
[pettanr/pettanr.git] / app / models / ground_color.rb
index 2f61ce1..5e8651f 100644 (file)
@@ -1,4 +1,4 @@
-class GroundColor < ActiveRecord::Base
+class GroundColor < Pettanr::Item
   include Element
   include ElementInspire
   belongs_to :panel
@@ -12,13 +12,20 @@ class GroundColor < ActiveRecord::Base
   validates :z, :presence => true, :numericality => {:greater_than => 0}
   validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
   
-  before_validation :valid_encode
+  def self.singular
+    'GroundColor'
+  end
   
-  def valid_encode
-    ['caption'].each do |a|
-      next if attributes[a] == nil
-      raise Pettanr::BadRequest unless attributes[a].valid_encoding?
-    end
+  def self.plural
+    'GroundColors'
+  end
+  
+  def self.owner_type
+    :author
+  end
+  
+  def self.valid_encode_columns
+    super.merge ['caption']
   end
   
   def self.colum_structures