Rails Haml复选框

Mar*_*iev 5 haml ruby-on-rails

愚蠢的问题,我怎么能用haml重写我的代码?

<% for role in Role.find(:all) %>
<div>
  <%= check_box_tag "user[role_ids][]", role.id, @user.roles.include?(role) %>
  <%= role.name %>
</div>
Run Code Online (Sandbox Code Playgroud)

我可以在哪里找到haml示例,例如http://apidock.com/rails/ActionView/Helpers/FormTagHelper/check_box_tag 谢谢!

meg*_*gas 11

- for role in Role.find(:all)
  %div
    = check_box_tag "user[role_ids][]", role.id, @user.roles.include?(role)
    = role.name
Run Code Online (Sandbox Code Playgroud)

我刚用http://html2haml.heroku.com/