app/controllers/motor/data_controller.rb in motor-admin-0.1.32 vs app/controllers/motor/data_controller.rb in motor-admin-0.1.33

- old
+ new

@@ -84,10 +84,12 @@ CanCan::ControllerResource.new( self, options ).load_and_authorize_resource + rescue ActiveRecord::RecordNotFound + head :not_found rescue StandardError => e render json: { errors: [e.message] }, status: :unprocessable_entity end def load_and_authorize_association @@ -105,9 +107,11 @@ instance_name: INSTANCE_VARIABLE_NAME ).load_and_authorize_resource else render json: { message: 'Unknown association' }, status: :not_found end + rescue ActiveRecord::RecordNotFound + head :not_found rescue StandardError => e render json: { errors: [e.message] }, status: :unprocessable_entity end def resource_params