-class Sheet < ActiveRecord::Base
+class Sheet < Pettanr::Item
has_many :sheet_panels
has_many :story_sheets
belongs_to :author
validates :height, :presence => true, :numericality => true, :natural_number => true
validates :visible, :presence => true, :numericality => true, :inclusion => {:in => 0..1}
accepts_nested_attributes_for :sheet_panels, :allow_destroy => true
- before_validation :valid_encode
- def valid_encode
- ['caption'].each do |a|
- next if attributes[a] == nil
- raise Pettanr::BadRequest unless attributes[a].valid_encoding?
- end
+ def self.singular
+ 'Sheet'
+ end
+
+ def self.plural
+ 'Sheets'
+ end
+
+ def self.owner_type
+ :author
+ end
+
+ def self.valid_encode_columns
+ super.merge ['caption']
end
def self.each_element_class_names