Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails Haml checkbox

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!

like image 774
Marat_Galiev Avatar asked Jan 11 '12 18:01

Marat_Galiev


1 Answers

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

I just used http://html2haml.heroku.com/

like image 200
megas Avatar answered Oct 17 '22 17:10

megas