我想添加一个css类:当用户在root_path上时登陆页面。我用的是haml。
%body
={:class => "landing-page" if current_page?(root_path)}我得到了一个语法错误,有什么想法,这应该是什么呢?
更新:--我做了这件事,它对我很有用:
%body{:class => "normal-page#{current_page?(root_path) ? 'landing-page' : ''}"}发布于 2013-06-25 17:57:45
尝尝这个
-body_class = current_page?(root_path) ? "landing-page" : ""
%body{:class => body_class}https://stackoverflow.com/questions/17304173
复制相似问题