Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Meta tag helper for Rails
# Accepts arguments like:
# meta_tag :warning, "HC SVNT DRACONES"
# or
# meta_tag charset: "utf-8"
def meta_tag *options
if (options.select {|o| o.is_a?(String) || o.is_a?(Symbol) }.count == options.count) && (options.count == 2)
tag :meta, name: options.first, content: options.last
else
tag :meta, *options
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment