diff options
Diffstat (limited to 'actionpack/lib/action_view/helpers/url_helper.rb')
-rw-r--r-- | actionpack/lib/action_view/helpers/url_helper.rb | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index d154f7c00c..4b7a2270dc 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -39,16 +39,15 @@ module ActionView # link_to "Busy loop", { :action => "busy" }, :popup => ['new_window', 'height=300,width=600'] # link_to "Destroy account", { :action => "destroy" }, :confirm => "Are you sure?", :post => true def link_to(name, options = {}, html_options = nil, *parameters_for_method_reference) - html_options = (html_options || {}).stringify_keys - convert_options_to_javascript!(html_options) - if options.is_a?(String) - content_tag "a", name || options, (html_options || {}).merge("href" => options) + if html_options + html_options = html_options.stringify_keys + convert_options_to_javascript!(html_options) + tag_options = tag_options(html_options) else - content_tag( - "a", name || url_for(options, *parameters_for_method_reference), - (html_options || {}).merge("href" => url_for(options, *parameters_for_method_reference)) - ) + tag_options = nil end + url = options.is_a?(String) ? options : url_for(options, *parameters_for_method_reference) + "<a href=\"#{url}\"#{tag_options}>#{name||url}</a>" end # Generates a form containing a sole button that submits to the @@ -236,7 +235,7 @@ module ActionView # Returns true if the current page uri is generated by the options passed (in url_for format). def current_page?(options) - url_for(options) == @request.request_uri + url_for(options) == @controller.request.request_uri end private |