0

我有一个输入包装器组件:

module InputGroup
    def prepend(wrapper_options = nil)
      span_tag = content_tag(:span, options[:prepend], class: "input-group-text")
      template.content_tag(:div, span_tag, class: "input-group-prepend")
    end

    def append(wrapper_options = nil)
      span_tag = content_tag(:span, options[:append], class: "input-group-text")
      template.content_tag(:div, span_tag, class: "input-group-append")
    end
  end

我可以像这样成功使用它:

<%= f.input :amount, prepend: '$' %>

但是,当与日期字段一起使用时,它不起作用,没有前面的符号:

<%= f.input :start_on, as::date, html5: true, prepend: "£" %>

如何调整我的 InputGroup 组件以适用于 html5 日期字段?

4

0 回答 0