index is nil in a fields_for nested attributes
Just hit an interesting bug and thankfully fixed it quick enough.
I have a model with entries that I render form fields for and use the
index for something.
The view looks like this and you get the index for free.
= form.fields_for :entries, form.object.entries do |entry_fields| = entry_fields.index / ...
But the index was nil everytime which is contradicing the documentation on
What I was missing in my model was
accepts_nested_attributes_for :entries to get the
class Transaction include Mongoid::Document embeds_many :entries accepts_nested_attributes_for :entries end