channel.rb 388 B

12345678910111213141516
  1. class Channel < ActiveRecord::Base
  2. attr_accessible :bot_id, :name, :activate
  3. # Relation
  4. belongs_to :bot
  5. # Validation
  6. validates :name,
  7. :uniqueness => true,
  8. :presence => true,
  9. :format => { :with => /\A#.+\z/, :message => "Channel name must begin with #" }
  10. validates_presence_of :bot_id
  11. validates_presence_of :bot_id, :on => :update
  12. end