OSDN Git Service

temp
[pettanr/pettanr.git] / app / models / balloon.rb
index 611481f..33e2c40 100644 (file)
@@ -1,4 +1,4 @@
-class Balloon < ActiveRecord::Base
+class Balloon < Pettanr::Item
   include ElementPart
   belongs_to :speech_balloon
   belongs_to :system_picture
@@ -13,13 +13,20 @@ class Balloon < ActiveRecord::Base
 #  validates :caption, :presence => true
   validates :settings, :extend_balloon => true
 
-  before_validation :valid_encode
+  def self.singular
+    'Balloon'
+  end
   
-  def valid_encode
-    ['settings'].each do |a|
-      next if attributes[a] == nil
-      raise Pettanr::BadRequest unless attributes[a].valid_encoding?
-    end
+  def self.plural
+    'Balloons'
+  end
+  
+  def self.owner_type
+    :author
+  end
+  
+  def self.valid_encode_columns
+    super.merge ['settings']
   end
   
   def self.colum_structures