aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/url_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view/helpers/url_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/url_helper.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb
index 4864e253a8..5bcfb5e75d 100644
--- a/actionpack/lib/action_view/helpers/url_helper.rb
+++ b/actionpack/lib/action_view/helpers/url_helper.rb
@@ -1,3 +1,5 @@
+require File.dirname(__FILE__) + '/javascript_helper'
+
module ActionView
module Helpers
# Provides a set of methods for making easy links and getting urls that depend on the controller and action. This means that
@@ -5,6 +7,8 @@ module ActionView
# synchronously, so link_to uses that same url as is generated by url_for, which again is the same url used for
# redirection in redirect_to.
module UrlHelper
+ include JavaScriptHelper
+
# Returns the URL for the set of +options+ provided. This takes the same options
# as url_for. For a list, see the url_for documentation in link:classes/ActionController/Base.html#M000079.
def url_for(options = {}, *parameters_for_method_reference)
@@ -219,7 +223,7 @@ module ActionView
private
def convert_confirm_option_to_javascript!(html_options)
if confirm = html_options.delete("confirm")
- html_options["onclick"] = "return confirm('#{confirm.gsub(/'/, '\\\\\'')}');"
+ html_options["onclick"] = "return confirm('#{escape_javascript(confirm)}');"
end
end