#ストーリー
-class Story < ActiveRecord::Base
+class Story < Pettanr::Item
has_many :story_sheets
belongs_to :comic
validates :title, :presence => true, :length => {:maximum => 100}
validates :visible, :presence => true, :numericality => true, :inclusion => {:in => 0..1}
validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
- before_validation :valid_encode
- def valid_encode
- ['title', 'description'].each do |a|
- next if attributes[a] == nil
- raise Pettanr::BadRequest unless attributes[a].valid_encoding?
- end
+ def self.singular
+ 'Story'
+ end
+
+ def self.plural
+ 'Stories'
+ end
+
+ def self.owner_type
+ :author
+ end
+
+ def self.valid_encode_columns
+ super.merge ['title', 'description']
end
def supply_default