#コマ
-class Panel < ActiveRecord::Base
+class Panel < Pettanr::Item
belongs_to :author
has_many :scroll_panels
has_many :sheet_panels
validates :author_id, :presence => true, :numericality => true, :existence => {:both => false}
validates :publish, :presence => true, :numericality => true
- cattr_reader :singular, :plural
- @@singular = 'Panel'
- @@plural = 'Panels'
- def self.item_name
- self.singular.underscore
+ def self.singular
+ 'Panel'
end
- def item_name
- self.class.item_name
+ def self.plural
+ 'Panels'
end
- def self.path_name with_engine = false
- self.plural.underscore
+ def self.owner_type
+ :author
end
- def path_name
- self.class.path_name
- end
-
- 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.valid_encode_columns
+ super.merge ['caption']
end
def self.each_element_class_names