-class WritingFormat < ActiveRecord::Base
+class WritingFormat < Pettanr::Item
has_many :speeches
belongs_to :system_picture
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