class Secdomain < ActiveRecord::Base attr_accessible :pid, :subname, :sub_type, :desc validates_presence_of :subname, :sub_type validates_uniqueness_of :subname def controller return 'organizations' if sub_type == 2 return 'users' if sub_type == 3 nil end def action return 'show' if sub_type == 2 return 'show' if sub_type == 3 nil end end