Skip to content

Commit e8783a9

Browse files
committed
generate a proper json response, so that $.ajax generates an actual object on response processing
1 parent 3f4d521 commit e8783a9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/gon/watch.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def return_variable?(variable)
109109
def return_variable(value)
110110
controller = Gon::Base.get_controller
111111

112-
controller.render :text => value.to_json
112+
controller.render :json => value
113113
end
114114

115115
end

spec/gon/watch_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
controller.params = params
5555
Gon::Request.env['action_controller.instance'] = controller
5656

57-
controller.should_receive('render').with(:text => '1')
57+
controller.should_receive('render').with(:json => 1)
5858

5959
Gon.watch.a = 1
6060
end

0 commit comments

Comments
 (0)