Fix JSON caching regression
Disable jQuery's AJAX caching to prevent the browser's back button from dumping the stream in JSON format. Includes a test for the jquery_include_tag helper to ensure that the necessary line of javascript doesn't go missing again. closes #3094
This commit is contained in:
parent
4ba3ec0b42
commit
a8843c1036
2 changed files with 5 additions and 0 deletions
|
|
@ -48,6 +48,7 @@ module ApplicationHelper
|
||||||
buf << [ javascript_include_tag('jquery') ]
|
buf << [ javascript_include_tag('jquery') ]
|
||||||
end
|
end
|
||||||
buf << [ javascript_include_tag('jquery_ujs') ]
|
buf << [ javascript_include_tag('jquery_ujs') ]
|
||||||
|
buf << [ javascript_tag("jQuery.ajaxSetup({'cache': false});") ]
|
||||||
buf.join("\n").html_safe
|
buf.join("\n").html_safe
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -78,5 +78,9 @@ describe ApplicationHelper do
|
||||||
it 'inclues jquery_ujs.js' do
|
it 'inclues jquery_ujs.js' do
|
||||||
jquery_include_tag.should match(/jquery_ujs\.js/)
|
jquery_include_tag.should match(/jquery_ujs\.js/)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "disables ajax caching" do
|
||||||
|
jquery_include_tag.should match(/jQuery\.ajaxSetup/)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue