Skip to content

Instantly share code, notes, and snippets.

@evanwalsh
Created August 12, 2012 00:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanwalsh/3328255 to your computer and use it in GitHub Desktop.
Save evanwalsh/3328255 to your computer and use it in GitHub Desktop.
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