Skip to content

Instantly share code, notes, and snippets.

@lcguida
Created March 7, 2016 18:06
Show Gist options
  • Save lcguida/53a8acf8db7aaee46533 to your computer and use it in GitHub Desktop.
Save lcguida/53a8acf8db7aaee46533 to your computer and use it in GitHub Desktop.
dl_for viewer helper
def dl_for(instance, attribute)
content = content_tag(:dt, class: "input-lg") do
instance.class.human_attribute_name(attribute)
end
content << content_tag(:dd, class: "input-lg") do
if block_given?
yield
else
instance.send(attribute)
end
end
content.html_safe
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment