class Channel < ActiveRecord::Base attr_accessible :bot_id, :name, :activate # Relation belongs_to :bot # Validation validates :name, :presence => true, :format => { :with => /\A#.+\z/, :message => "Channel name must begin with #" } validates_presence_of :bot_id validates_presence_of :bot_id, :on => :update end