gpt4 book ai didi

ruby-on-rails - 在 Label 标签中嵌套 Ruby on Rails HAML 复选框

转载 作者:数据小太阳 更新时间:2023-10-29 07:11:16 25 4
gpt4 key购买 nike

我有以下不起作用的代码:

= 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"

它只能以这种方式工作,但我需要它在一行中而不是在 wto 中:

%p
= f.label :remember_me, :class => "checkbox"
= f.check_box :remember_me, :class => "checkbox"

求助!我现在真的很绝望。我只想将复选框嵌套在 bootsrap 表单的标签中。我搜索了 google 和 stackoverflow 但一无所获

更新:

我现在是这样解决的:

- if devise_mapping.rememberable?
%p
%label.checkbox{ :for => "remember_me" }
= f.check_box :remember_me, :class => "checkbox"
Remember

最佳答案

关于:

%p
= f.label :remember_me, :class => "checkbox" do
= f.check_box :remember_me, :class => "checkbox"

关于ruby-on-rails - 在 Label 标签中嵌套 Ruby on Rails HAML 复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9774555/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com