Skip to content

Instantly share code, notes, and snippets.

@maxivak
Last active August 29, 2015 14:11
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 maxivak/e0cee158eb2f1c892cff to your computer and use it in GitHub Desktop.
Save maxivak/e0cee158eb2f1c892cff to your computer and use it in GitHub Desktop.
Rails HAML Examples

HAML Examples

Append class if condition is true in Haml

.class1{:class => ("gray" unless post.published?)}
%div{class: ["class1", ("gray" unless post.published?)]}
%div{class: post.published? && 'gray' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment