fixes #1412: When creating or deleting favorites through the API, return some form of response

This commit is contained in:
r888888888
2015-07-29 17:50:59 -07:00
parent 8c57476667
commit ed3bbbe177

View File

@@ -30,6 +30,13 @@ class FavoritesController < ApplicationController
redirect_to(mobile_post_path(@post))
end
format.js
format.json do
if @post
render :json => {:success => true}.to_json
else
render :json => {:success => false, :reason => @error_msg}.to_json, :status => 422
end
end
end
end
@@ -42,6 +49,9 @@ class FavoritesController < ApplicationController
redirect_to(mobile_post_path(@post))
end
format.js
format.json do
render :json => {:success => true}.to_json
end
end
end
end