Now that I'm thinking about it, you can maybe even make it more generic if
you like. I can actually think of a few places in my own code this would
come in handy:
def content_tag_if(condition, tag, content = nil, &block)
if block_given?
content = capture(&block)
end
return content_tag(tag, content) if condition
return content
end
= content_tag_if(defined?(skipLI) && skipLI, :li) do
%span This is not DRY
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/bPOPDdNZ2IgJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.