提交 58c3a045 编写于 作者: S Steven Spiel

Update url_helper.rb

add block to link_to_if when condition is true
上级 43be687b
......@@ -410,7 +410,7 @@ def link_to_unless(condition, name, options = {}, html_options = {}, &block)
# # => <a href="/accounts/show/3">my_username</a>
def link_to_if(condition, name, options = {}, html_options = {}, &block)
if condition
link_to(name, options, html_options)
link_to(name, options, html_options, &block)
else
if block_given?
block.arity <= 1 ? capture(name, &block) : capture(name, options, html_options, &block)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册