store_attribute icon indicating copy to clipboard operation
store_attribute copied to clipboard

fix(#52,#54): Fix attribute synchronization for registered store attributes

Open mdayaram opened this issue 5 months ago • 0 comments

Previously, registered store attributes could show inconsistent values between the store and Rails' attribute system, causing validation failures and incorrect behavior with methods like attributes, *_before_type_cast, and dirty tracking. This fix ensures proper synchronization between both systems.

This PR introduces an AttributesSync module that maintains proper synchronization between store values and registered attributes by:

  • Overriding attribute accessors to ensure both systems stay in sync
  • Adding lifecycle callbacks to sync values after initialization and database loads
  • Fixing the attributes method to return actual store values instead of defaults
  • Ensuring proper type casting in both the store and attribute systems

Fixes #52 Fixes #54

Checklist

  • [x] I've added tests for this change
  • [x] I've added a Changelog entry
  • [x] I've updated a documentation (Readme)

mdayaram avatar Jul 30 '25 00:07 mdayaram