Rails include_blank with content_tag and select -


i created builder object, used create select elements. looks this:

module formhelper   def list_filter(field, label, sources, options = {})     filter.new(field, label, sources, options.merge(template: self)).render   end end    class filter   attr_accessor :field, :label, :sources, :template    def initialize(field, label, sources, options = {})     @label = label     @field = field     @sources = sources     assign_attributes(options)   end    def options_for_select     template.send(:options_for_select,[['abc',1],['def',2],['ghi',3]], template.params[name])   end    def html_options     attrs = {}     attrs['class'] = 'abc'     attrs['name'] = field     attrs   end    def render     template.content_tag(:select, options_for_select, html_options )   end end 

my problem when use content_tag select, how able use include_blank or prompt option?

something not work:

template.content_tag(:select, options_for_select, { include_blank: true }.merge(html_attributes) ) 


Comments