我想在不应该在Slim中显示类时删除class属性.
在再培训局,我可以使用:
<input <%= "class='foo'" if false %> />
<input />
Run Code Online (Sandbox Code Playgroud)
我怎么在Slim中做到这一点?
我找到了这个,但我觉得必须有一个更惯用的解决方案:
| <input "#{'class=\"foo\"' if false}" />
Run Code Online (Sandbox Code Playgroud) 我有一个带有created_at属性的问题对象.当我找到一个问题时,我从REST服务返回created_at,但Activeresource不会将日期字符串转换为DateTime.
Question.find(1)
/questions/1.json
Question.find(1).created_at.class
=> String
Run Code Online (Sandbox Code Playgroud)
以哪种格式应该是Json响应,以便ActiveResource将其转换为DateTime?
如果不可能,我该怎么办?