Created
September 8, 2014 14:41
-
-
Save rheaton/3743f78a1d3a9cb67963 to your computer and use it in GitHub Desktop.
body classes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<body class='class-for-all-pages <%= body_classes%>'> | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ApplicationHelper | |
def add_body_class(*classes) | |
@_body_classes ||= [] | |
@_body_classes << classes | |
nil | |
end | |
def body_classes | |
@_body_classes.try(:join, " ") | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%- add_body_class 'myspecialpage' -%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment