Closed kdiogenes closed 6 years ago
Version 0.7.3 introduced support to non-integer primary keys, this breaks the common idiom in controllers for integer primary keys:
subject.record_attributes = subject_params['record_attributes']
This happens, because the params attributes are all strings, but when the subject.record is constructed their values are casted to the database types, making the comparison in https://github.com/makandra/active_type/blob/master/lib/active_type/nested_attributes/nests_one_association.rb#L22 fail, since an integer gets compared with an string.
I don't like the idiom of my fix, so if anyone has a better idea, feel free to suggest.
Thanks!
I've fixed the travis issues in master, so could you merge/rebase onto master?
Released as 0.7.5. Thanks for the fix!
Version 0.7.3 introduced support to non-integer primary keys, this breaks the common idiom in controllers for integer primary keys:
subject.record_attributes = subject_params['record_attributes']
This happens, because the params attributes are all strings, but when the subject.record is constructed their values are casted to the database types, making the comparison in https://github.com/makandra/active_type/blob/master/lib/active_type/nested_attributes/nests_one_association.rb#L22 fail, since an integer gets compared with an string.
I don't like the idiom of my fix, so if anyone has a better idea, feel free to suggest.
Thanks!