class Role < ActiveRecord::Base has_many :user_roles, :dependent => :destroy validates_presence_of :name validates_presence_of :code validates_presence_of :about validates_length_of :name, :within => 1..128 validates_length_of :code, :within => 1..128 validates_length_of :about, :within => 1..128 validates_uniqueness_of :name validates_uniqueness_of :code end