Rails Haml 复选框
愚蠢的问题,我如何用 haml 重写我的代码?
<% for role in Role.find(:all) %>
<div>
<%= check_box_tag "user[role_ids][]", role.id, @user.roles.include?(role) %>
<%= role.name %>
</div>
我可以在哪里找到 haml 示例,例如 http://apidock.com/rails/ActionView/助手/FormTagHelper/check_box_tag 谢谢!
stupid questions, how I can rewrite my code in haml?
<% for role in Role.find(:all) %>
<div>
<%= check_box_tag "user[role_ids][]", role.id, @user.roles.include?(role) %>
<%= role.name %>
</div>
And where I can found haml examples, like http://apidock.com/rails/ActionView/Helpers/FormTagHelper/check_box_tag
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许还不算太晚,但您始终可以运行
html2haml
命令。类似于:html2haml app/views/layout/application.html.erb app/views/layouts/application.html.haml
Maybe is not too late, but always you could run the
html2haml
command. Something like:html2haml app/views/layout/application.html.erb app/views/layouts/application.html.haml
我刚刚使用 http://html2haml.heroku.com/
I just used http://html2haml.heroku.com/