ので、
application_helper.rb
module ApplicationHelper
def link_to_if_with_block(condition, options = nil, html_options = nil, &block)
if condition
link_to(options, html_options, &block)
else
capture(&block)
end
end
end
ッテの書いた。
hoge.html.haml
= link_to_if_with_block user_signed_in? user_path(current_user) do
.image
= user.image
.name
= user.name
こんな風に書ける。