OSDN Git Service

temp
[pettanr/pettanr.git] / app / models / writing_format.rb
index 9ea43fc..e7d04a2 100644 (file)
@@ -1,4 +1,4 @@
-class WritingFormat < ActiveRecord::Base
+class WritingFormat < Pettanr::Item
   has_many :speeches
   belongs_to :system_picture
   
@@ -9,13 +9,20 @@ class WritingFormat < ActiveRecord::Base
   validates :system_picture_id, :presence => true, :numericality => true, :existence => {:both => false}
   validates :settings, :presence => true
   
-  before_validation :valid_encode
+  def self.singular
+    'WritingFormat'
+  end
   
-  def valid_encode
-    ['name', 'classname', 'caption', 'settings'].each do |a|
-      next if attributes[a] == nil
-      raise Pettanr::BadRequest unless attributes[a].valid_encoding?
-    end
+  def self.plural
+    'WritingFormats'
+  end
+  
+  def self.owner_type
+    :author
+  end
+  
+  def self.valid_encode_columns
+    super.merge ['name', 'classname', 'caption', 'settings']
   end
   
   def supply_default