OSDN Git Service

fix:error dlg
[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   
9   validates :name, :presence => true, :length => {:maximum => 30}
10   validates :user_id, :numericality => true, :existence => {:both => false}
11   
12   scope :find_index, -> do
13     self
14   end
15   
16   def supply_default
17     self.name = 'no name' if self.name.blank?
18     self.user_id = nil
19   end
20   
21   def self.show_opt
22     {:include => {:user => {:artist => {}}} }
23   end
24   
25 end