diff options
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/filters.rb | 16 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/url_helper.rb | 13 |
2 files changed, 16 insertions, 13 deletions
diff --git a/actionpack/lib/action_controller/filters.rb b/actionpack/lib/action_controller/filters.rb index bd5c545dfb..1691f031f8 100644 --- a/actionpack/lib/action_controller/filters.rb +++ b/actionpack/lib/action_controller/filters.rb @@ -130,15 +130,15 @@ module ActionController #:nodoc: # The passed <tt>filters</tt> will be appended to the array of filters that's run _before_ actions # on this controller are performed. def append_before_filter(*filters, &block) - filters << block if block_given? - append_filter_to_chain("before", filters) + filters << block if block_given? + append_filter_to_chain("before", filters) end # The passed <tt>filters</tt> will be prepended to the array of filters that's run _before_ actions # on this controller are performed. def prepend_before_filter(*filters, &block) - filters << block if block_given? - prepend_filter_to_chain("before", filters) + filters << block if block_given? + prepend_filter_to_chain("before", filters) end # Short-hand for append_before_filter since that's the most common of the two. @@ -147,15 +147,15 @@ module ActionController #:nodoc: # The passed <tt>filters</tt> will be appended to the array of filters that's run _after_ actions # on this controller are performed. def append_after_filter(*filters, &block) - filters << block if block_given? - append_filter_to_chain("after", filters) + filters << block if block_given? + append_filter_to_chain("after", filters) end # The passed <tt>filters</tt> will be prepended to the array of filters that's run _after_ actions # on this controller are performed. def prepend_after_filter(*filters, &block) - filters << block if block_given? - prepend_filter_to_chain("after", filters) + filters << block if block_given? + prepend_filter_to_chain("after", filters) end # Short-hand for append_after_filter since that's the most common of the two. diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index 098fce8100..0113c42eb7 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -13,15 +13,18 @@ module ActionView # Creates a link tag of the given +name+ using an URL created by the set of +options+. See the valid options in # link:classes/ActionController/Base.html#M000021. It's also possible to pass a string instead of an options hash to - # get a link tag that just points without consideration. The html_options have a special feature for creating javascript - # confirm alerts where if you pass :confirm => 'Are you sure?', the link will be guarded with a JS popup asking that question. - # If the user accepts, the link is processed, otherwise not. + # get a link tag that just points without consideration. If nil is passed as a name, the link itself will become the name. + # The html_options have a special feature for creating javascript confirm alerts where if you pass :confirm => 'Are you sure?', + # the link will be guarded with a JS popup asking that question. If the user accepts, the link is processed, otherwise not. def link_to(name, options = {}, html_options = {}, *parameters_for_method_reference) convert_confirm_option_to_javascript!(html_options) unless html_options.nil? if options.is_a?(String) - content_tag "a", name, (html_options || {}).merge({ "href" => options }) + content_tag "a", name || options, (html_options || {}).merge({ "href" => options }) else - content_tag("a", name, (html_options || {}).merge({ "href" => url_for(options, *parameters_for_method_reference) })) + content_tag( + "a", name || url_for(options, *parameters_for_method_reference), + (html_options || {}).merge({ "href" => url_for(options, *parameters_for_method_reference) }) + ) end end |