如何使用simple_form添加复选框而不与模型关联? 我想创建复选框,它将处理一些javascript事件,但不知道? 也许我错过了文档中的东西? Want't使用类似像下面:用simple_form添加复选框而不与模型关联?
= simple_form_for(resource, as: resource_name, url: session_url(resource_name), wrapper: :inline) do |f|
.inputs
= f.input :email, required: false, autofocus: true
= f.input :password, required: false
= f.input :remember_me, as: :boolean if devise_mapping.rememberable?
= my_checkbox, 'some text'
如果此复选框与模型没有关联为什么不使用standart复选框助手? http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-check_box_tag – 2012-02-07 19:21:55
我懒得使用各种CSS) – 2012-02-07 19:46:53
我不认为你可以使用simple_form助手没有记录字段。不要使用simple_form为你的复选框生成的类,你不需要添加自定义的CSS。我注意到你是来自塞瓦斯托波尔进入我们当地的塞瓦斯托波尔.rb聚会在这天!干杯! – 2012-02-07 21:21:07