I have a simple nested form where it displays the fields for a user's dashboard and the nested attributes for the dashboard's tiles (aka widgets). I'm using Rails 4.1 and would like to only display the :tiles
for the enum :middle_column (whose value is 2)
. What would be the proper syntax for changing the f.simple_fields_for :tiles do |builder|
to limit to the enum :middle_column
?
<%= simple_form_for [@user, @dashboard] do |f| %>
<%= f.simple_fields_for :tiles do |builder| %>
<%= render "widgets/#{builder.object.widget.function}_fields", f: builder %>
<% end %>
<% end %>