Skip to content

Instantly share code, notes, and snippets.

@ppworks
Created November 15, 2013 08:06
Show Gist options
  • Save ppworks/7480800 to your computer and use it in GitHub Desktop.
Save ppworks/7480800 to your computer and use it in GitHub Desktop.
link_to_ifにブロック渡した時の挙動が欲しいのと違う ref: http://qiita.com/ppworks/items/9bf917edf0d4927b15bd
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
= link_to_if_with_block user_signed_in? user_path(current_user) do
.image
= user.image
.name
= user.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment