Skip to content

Instantly share code, notes, and snippets.

@taea taea/if_class.haml
Last active Dec 19, 2015

What would you like to do?
if ○○だった時だけ classをつける
%span.count-num{ class: "#{'unread' if hoge_count > 0}" }<>= link_to hoge_count, hoge_path

This comment has been minimized.

Copy link

fukajun commented Jun 10, 2014

これ、条件に当てはまらない時 <span class></span> になりますね。(好みの問題?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.