byroot / activerecord-typedstore

ActiveRecord::Store but with type definition
MIT License
437 stars 57 forks source link

Persist default values for Rails 6.1 #97

Closed jonathanhefner closed 1 year ago

jonathanhefner commented 1 year ago

This extends the fix from 1f150f6bc3194f803b15c400513f07aacf53939b to Rails 6.1, and adds test coverage. Specifically, it adds a record reload to the "stores the default on creation" test to ensure that the postcondition holds. Without the reload, the "stores the default on creation" test would pass even before 1f150f6bc3194f803b15c400513f07aacf53939b.

This commit also adds a test for when the record is partially loaded, and changes some Rails private API calls to equivalent public API calls.


Extracted from #96.

jonathanhefner commented 1 year ago

Based on the previous test failure, I pushed a commit to extend the fix from #95 to Rails 6.1.