I was trying to get the nested_form gem working with strong_parameters. And I am having some trouble getting the two of them working nicely together.
I am not quite sure how to fix this, but i have added a failing test describing the problem. I could also try to change nested_form, but I think the solution would be more flexible if strong_parameters supported this.
One solution could be allowing the regexp, currently used for detecting integer based keys, to be changed in a configuration setting.
added failing test for nested fields_for with alphanumeric keys
I'm struggling with nested resources as well. However, your problem should IMHO be fixed on the nested_form gem. The prefix author_in keys such as author_1 inside the authors_attributes is redundant and inconsistent with out of the box nested forms. I'm not sure to what extend numeric keys may be a convention already, but it seems to make sense to stick to such a rule in order to keep other code working with the params hash (such as strong_parameters) as configuration free as possible.
Thank you for your comments. I looked into the nested form gem, trying to understand why they prefix some with new_. It is to prevent clashes with the ids generated and existing ids in the db
@kibs: Ah, good point, forgot about that.
nested_form has removed the new prefix, the id is not taken from the key anyway. At least not anymore. I am closing this.