OSDN Git Service

temp
[pettanr/pettanr.git] / app / models / speech.rb
index 7f31064..af6f09e 100644 (file)
@@ -1,4 +1,4 @@
-class Speech < ActiveRecord::Base
+class Speech < Pettanr::Item
   include ElementPart
   belongs_to :speech_balloon
   belongs_to :writing_format
@@ -17,13 +17,20 @@ class Speech < ActiveRecord::Base
   
   @@text_align_texts = ['left', 'left', 'right', 'center']
   
-  before_validation :valid_encode
+  def self.singular
+    'Speech'
+  end
   
-  def valid_encode
-    ['content', 'quotes', 'settings'].each do |a|
-      next if attributes[a] == nil
-      raise Pettanr::BadRequest unless attributes[a].valid_encoding?
-    end
+  def self.plural
+    'Speeches'
+  end
+  
+  def self.owner_type
+    :author
+  end
+  
+  def self.valid_encode_columns
+    super.merge ['content', 'quotes', 'settings']
   end
   
   def self.colum_structures