1
我有一個簡單的嵌套窗體,它顯示用戶的儀表板的字段以及儀表板的tile(aka窗口小部件)的嵌套屬性。我正在使用Rails 4.1,並且只想爲enum :middle_column (whose value is 2)
顯示:tiles
。將f.simple_fields_for :tiles do |builder|
更改爲enum :middle_column
的適當語法是什麼?Rails 4.1 enum限制返回fields_for
<%= 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 %>