bot.rb 475 B

1234567891011121314
  1. class Bot < ActiveRecord::Base
  2. attr_accessible :botnick, :owner, :activate
  3. # Relation
  4. has_many :channels, :dependent => :destroy, :inverse_of => :bot
  5. accepts_nested_attributes_for :channels, :allow_destroy => true
  6. # Validation
  7. validates :botnick, :presence => true, :format => { :with => /\A[a-zA-Z0-9]*+\z/,
  8. :message => "Channel name must be alphanumeric" }
  9. validates :owner, :presence => true
  10. end