【发布时间】:2019-01-25 18:19:13
【问题描述】:
给定一个自定义的 SimpleForm 输入
class MyCustomInput < SimpleForm::Inputs::Base
# some stuff
end
我如何配置它,以便这些输入默认没有包装器。
通常我会像这样设置特定于输入的包装器:
# initializers/simpleform
config.wrapper_mappings = {
my_custom: :my_wrapper
}
但以下不起作用,仍然应用默认的 SimpleForm 包装器。
config.wrapper_mappings = {
my_custom: false
}
我知道有一些方法可以在视图中实现这一点,例如,
<%= f.input :attribute, as: :my_custom, wrapper: false %>
或
<%= f.input_field :attribute %>
但这不是我想要的。
有没有办法配置输入以使默认没有包装器?
【问题讨论】: