parent
dd09c36a8f
commit
b4209b7cc5
@ -0,0 +1,15 @@
|
|||||||
|
require_dependency "seems_rateable/application_controller"
|
||||||
|
|
||||||
|
class RatingsController < ::ApplicationController
|
||||||
|
def create
|
||||||
|
raise NoCurrentUserInstanceError unless current_user
|
||||||
|
|
||||||
|
obj = params[:kls].classify.constantize.find(params[:idBox])
|
||||||
|
begin
|
||||||
|
obj.rate(params[:rate].to_i, current_user.id, params[:dimension])
|
||||||
|
render :json => true
|
||||||
|
rescue Errors::AlreadyRatedError
|
||||||
|
render :json => {:error => true}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -1,17 +0,0 @@
|
|||||||
require_dependency "seems_rateable/application_controller"
|
|
||||||
|
|
||||||
module SeemsRateable
|
|
||||||
class RatingsController < ::ApplicationController
|
|
||||||
def create
|
|
||||||
raise NoCurrentUserInstanceError unless current_user
|
|
||||||
|
|
||||||
obj = params[:kls].classify.constantize.find(params[:idBox])
|
|
||||||
begin
|
|
||||||
obj.rate(params[:rate].to_i, current_user.id, params[:dimension])
|
|
||||||
render :json => true
|
|
||||||
rescue Errors::AlreadyRatedError
|
|
||||||
render :json => {:error => true}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
After Width: | Height: | Size: 572 B |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 1018 B |
Loading…
Reference in new issue