makandra / active_type

Make any Ruby object quack like ActiveRecord
MIT License
1.09k stars 74 forks source link

Fix/child match #101

Closed kdiogenes closed 6 years ago

kdiogenes commented 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!

kratob commented 6 years ago

I've fixed the travis issues in master, so could you merge/rebase onto master?

kratob commented 6 years ago

Released as 0.7.5. Thanks for the fix!