jasonmk / datastax_rails

A Ruby-on-Rails interface to Datastax Enterprise. Replaces the majority of ActiveRecord functionality.
MIT License
23 stars 9 forks source link

Overridden lists get lost after save #29

Closed jasonmk closed 10 years ago

jasonmk commented 10 years ago

Apparently, if you override a list attribute reader to return anything other than the same object, you end up with the previous value after you call save even though the correct value gets saved. Calling reload fixes the issue.

jasonmk commented 10 years ago

After digging through lots of Rails code, It seems that the issue happens in the convert_value method of HashWithIndifferentAccess. If we don't do the map! there, the issue goes away. I think this might be a Rails bug, but I'll have to investigate further. If I can craft a test case, I'll submit it. In the mean time, I've hacked a way around it.