to_json should be as_json or there's bugs (#870)

* to_json should be as_json or there's bugs

* revert explore controller, it's better without

* revert search controller and some topic methods
This commit is contained in:
Devin Howard 2016-10-29 18:28:29 +08:00 committed by GitHub
parent 6cc827d11c
commit a32f98bde2
2 changed files with 6 additions and 6 deletions

View file

@ -83,7 +83,7 @@ class MapsController < ApplicationController
# GET maps/:id/contains
def contains
respond_to do |format|
format.json { render json: @map.contains(current_user).to_json(user: current_user) }
format.json { render json: @map.contains(current_user).as_json(user: current_user) }
end
end

View file

@ -39,7 +39,7 @@ class TopicsController < ApplicationController
respond_with(@allsynapses, @alltopics, @allcreators, @topic)
end
format.json { render json: @topic.to_json(user: current_user) }
format.json { render json: @topic.as_json(user: current_user).to_json }
end
end
@ -55,9 +55,9 @@ class TopicsController < ApplicationController
@allcreators += @allsynapses.map(&:user).uniq
@json = {}
@json['topic'] = @topic.to_json(user: current_user)
@json['topic'] = @topic.as_json(user: current_user)
@json['creators'] = @allcreators
@json['relatives'] = @alltopics.to_json(user: current_user)
@json['relatives'] = @alltopics.as_json(user: current_user)
@json['synapses'] = @allsynapses
respond_to do |format|
@ -114,7 +114,7 @@ class TopicsController < ApplicationController
end
@json = {}
@json['topics'] = alltopics.to_json(user: current_user)
@json['topics'] = alltopics.as_json(user: current_user)
@json['synapses'] = allsynapses
@json['creators'] = allcreators
@ -131,7 +131,7 @@ class TopicsController < ApplicationController
respond_to do |format|
if @topic.save
format.json { render json: @topic.to_json(user: current_user), status: :created }
format.json { render json: @topic.as_json(user: current_user), status: :created }
else
format.json { render json: @topic.errors, status: :unprocessable_entity }
end