OSDN Git Service

classname rename to module_name
[pettanr/pettanr.git] / app / models / author.rb
1 class Author < Peta::Owner
2   load_manifest
3   belongs_to :user
4   has_many :scrolls
5   has_many :comics
6   has_many :sheets
7   has_many :panels
8   belongs_to :working_panel, :class_name => "Panel"
9   
10   validates :name, :presence => true, :length => {:maximum => 30}
11   validates :working_panel_id, :numericality => {:allow_nil => true}
12   validates :user_id, :numericality => true, :existence => {:both => false}
13   
14   def supply_default
15     self.name = 'no name' if self.name.blank?
16     self.user_id = nil
17   end
18   
19   def working?
20     self.working_panel_id and self.working_panel
21   end
22   
23   def self.show_opt
24     {:include => {:user => {:artist => {}}} }
25   end
26   
27 end