Skip to content

Instantly share code, notes, and snippets.

@rheaton
Created September 8, 2014 14:41
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 rheaton/3743f78a1d3a9cb67963 to your computer and use it in GitHub Desktop.
Save rheaton/3743f78a1d3a9cb67963 to your computer and use it in GitHub Desktop.
body classes
...
<body class='class-for-all-pages <%= body_classes%>'>
...
module ApplicationHelper
def add_body_class(*classes)
@_body_classes ||= []
@_body_classes << classes
nil
end
def body_classes
@_body_classes.try(:join, " ")
end
end
<%- add_body_class 'myspecialpage' -%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment