愚蠢的问题,我怎么能用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/Helpers/FormTagHelper/check_box_tag 谢谢!
答案 0 :(得分:11)
- for role in Role.find(:all)
%div
= check_box_tag "user[role_ids][]", role.id, @user.roles.include?(role)
= role.name
答案 1 :(得分:0)
也许为时不晚,但总是可以运行html2haml
命令。类似于:html2haml app/views/layout/application.html.erb app/views/layouts/application.html.haml