Nesting Ruby on Rails HAML Checkbox in Label Tag
- by user1279116
I have the following code which doesn't work:
= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => "well" }) do |f|
= f.label :email
= f.email_field :email
= f.label :password
= f.password_field :password
- if devise_mapping.rememberable?
%p
= f.label :remember_me, :class => "checkbox"
= f.check_box :remember_me, :class => "checkbox"
%div= f.submit "Einloggen"
= render :partial => "devise/shared/links"
It only works in that way, but I need it in one line and not in wto:
%p
= f.label :remember_me, :class => "checkbox"
= f.check_box :remember_me, :class => "checkbox"
Please help! I'm really desprate right now. I just want the checkbox nested in the label for the bootsrap form. I searched google and stackoverflow but found nothing
UPDATE:
I solved it now like this:
- if devise_mapping.rememberable?
%p
%label.checkbox{ :for => "remember_me" }
= f.check_box :remember_me, :class => "checkbox"
Remember