From d9cadfc43eb9adfd3c61c749525de4ce26d6a29f Mon Sep 17 00:00:00 2001 From: yanxd Date: Wed, 23 Apr 2014 09:20:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95500=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/controllers/seems_rateable/ratings_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/seems_rateable/app/controllers/seems_rateable/ratings_controller.rb b/lib/seems_rateable/app/controllers/seems_rateable/ratings_controller.rb index f96dfdc8..4c8758f0 100644 --- a/lib/seems_rateable/app/controllers/seems_rateable/ratings_controller.rb +++ b/lib/seems_rateable/app/controllers/seems_rateable/ratings_controller.rb @@ -3,11 +3,14 @@ require_dependency "seems_rateable/application_controller" module SeemsRateable class RatingsController < ApplicationController def create - raise NoCurrentUserInstanceError unless current_user + raise Errors::NoCurrentUserInstanceError unless current_user obj = params[:kls].classify.constantize.find(params[:idBox]) obj.rate(params[:rate].to_i, current_user.id, params[:dimension]) render :json => true + + rescue Errors::NoCurrentUserInstanceError + render :json => {:error => 'you must be login.'} end end end