I have run into a problem when updating one of the company applications to rails 3.2.11 from 3.2.8. I did some more digging and found that its actually 3.2.8 to 3.2.9 where this breaks.
I have a many to many relationship between two models with a join table in between. I am using simple_form and f.association in a form to create this association at the same time one of the objects on either side is created.
I created a very simple app to demonstrate the problem but I am afraid thats as far as I can get with this problem. I was hoping someone with a little more knowledge of simple_form and rails could nail down what the problem is. I suspect it is a simple_form issue hence why I am posting here.
example app: https://github.com/travis6/simple_example_2
@travis6 hey, did you just update Rails or SimpleForm was also bumped during the process? Just want to make sure where to start. Thanks.
Also can you describe how it was working and how it's broken now?
The simple_form version stays at 2.0.4 throughout this entire process.
When creating a new training record, the training_id gets set in the record created in assignments table and business continues.
When created a new training record, the training_id is set to nil in assignments table and due to the database constraint in my migration, an error is thrown when the app tries to create the assignment record.
I try to walk through what is happening in the readme in the example application. I should also mention that everything works correctly when doing an update (edit: vs creating a new training record) so it is some issue with the new training records id not getting passed to the new assignment record.
I hope this helps clarify, let me know if you need any more information.
@travis6 thank you so much for that sample application, it helped a lot! So this bug was introduced in rails/rails#7661 this PR. But I have great news - it was reverted and as a result it'll be fixed in the future 3.2.x release (I think it'll be 3.2.12). Since it's not a SimpleForm's issue I'm closing this. Thank you for letting us know about this. ❤️
Sounds good. Thanks for looking into this.
Update: This fix is included in the 3-2 stable branch but was not tagged for the 3.2.12 release which came out yesterday.
Yup, 3.2.12 is a sec release so it doesn't include anything from 3-2-stable but the sec fixes. It'll be available in the next 3.2.x release under "normal" circumstances :)