Does form_tag work with Simple_form?

后端 未结 4 1334
别那么骄傲
别那么骄傲 2020-12-12 22:11

I have a form that is using form_tag and not sure how to use it with the simple_form gem. This is how my form looks:

<%= form_tag create_mult         


        
4条回答
  •  猫巷女王i
    2020-12-12 22:56

    like @barelyknown said You can use simple_form even without model You can also use field_for or simple_field_for

    <%= simple_form_for :transaction_limits, {url: create_multiple_prices_path, method: :post} do |f| %>
      <% @prices.each_with_index do |price, index| %>
        <%= f.fields_for "prices[#{index}]", price do |up| %>
          <%= render "fields", :f => up %>
        <% end %>
      <% end %>
    
      <%= f.submit "button" %>
    <% end %>
    

提交回复
热议问题