在我的申请表中,我有以下表格:
.row
= simple_form_for @post, html: { class: 'form-horizontal' },
wrapper: :horizontal_form do |f|
= f.error_notification
.col-md-8
= f.input :text, as: :prepend
= f.input :active
= f.button :submit
和自定义输入:
class PrependInput < SimpleForm::Inputs::Base
def input
template.content_tag(:div, class: 'col-md-12') do
template.content_tag(:div, class: 'input-group') do
template.concat cal_addon
template.concat @builder.text_field(attribute_name, input_html_options)
end
end
end
def cal_icon
"<i class=\"fa fa-calendar\"></i>".html_safe
end
def cal_addon
template.content_tag(:span, class: 'input-group-addon') do
template.concat cal_icon
end
end
def input_html_options
{class: 'form-control datepicker margin-top-none'}
end
end
现在我想将其他属性传递给此选项&#34; as&#34;并在这个自定义输入中使用它们,有没有可能做这件事?