ruby - how to set "data-" of rails f.select -
i use rails 4.
<%= f.select :industry_id, options_from_collection_for_select([], "id", "name"), 'data-option-dependent' => true, 'data-option-observed' => 'pre_industry_id', 'data-option-url' => '/industries/:pre_industy_id:/sub_industry.json', 'data-option-key-method' => :id, 'data-option_value-method' => :name %>
but...
in result, data-attributes don't appear.
<select id="review_industry_id" name="review[industry_id]"></select>
pass data
hash option select
's html_options
argument:
<%= f.select :industry_id, options_from_collection_for_select([], "id", "name"), {}, data: { 'option-dependent' => true, 'option-observed' => 'pre_industry_id', 'option-url' => '/industries/:pre_industy_id:/sub_industry.json', 'option-key-method' => :id, 'option_value-method' => :name } %>
Comments
Post a Comment