add additional controller logic and fix activerecord table bug