123456789101112131415161718192021 |
- class Bot < ActiveRecord::Base
- attr_accessible :botnick, :owner, :activate
- # Relation
- has_many :channels, :dependent => :destroy, :inverse_of => :bot
- accepts_nested_attributes_for :channels, :allow_destroy => true
- # Validation
- validates :botnick,
- :uniqueness => true,
- :presence => true,
- :format => { :with => /\A[a-zA-Z0-9]*+\z/, :message => "Channel name must be alphanumeric" }
- validates :owner,
- :presence => true
- end
|