1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Update url_helper.rb

add block to link_to_if when condition is true
This commit is contained in:
Steven Spiel 2015-04-21 09:38:20 -04:00
parent 43be687bf3
commit 58c3a04512

View file

@ -410,7 +410,7 @@ module ActionView
# # => <a href="/accounts/show/3">my_username</a> # # => <a href="/accounts/show/3">my_username</a>
def link_to_if(condition, name, options = {}, html_options = {}, &block) def link_to_if(condition, name, options = {}, html_options = {}, &block)
if condition if condition
link_to(name, options, html_options) link_to(name, options, html_options, &block)
else else
if block_given? if block_given?
block.arity <= 1 ? capture(name, &block) : capture(name, options, html_options, &block) block.arity <= 1 ? capture(name, &block) : capture(name, options, html_options, &block)