DmitryTsepelev/store_model
64.2
Adequate · 6 November 2026
1.9k
lines of production code
Ruby
primary language
4
measurements over time
What this system is
Features
Added parent tracking and ActiveAdmin compatibility extensions
StoreModel now automatically tracks the parent record for nested model instances via new extension files in lib/store\_model/ext. The ParentAssignment module hooks into ActiveModel and ActiveRecord attribute read/write methods to set the parent reference on StoreModel instances, arrays, and hashes. Additionally, a new ActiveAdminCompatibility module provides reflection and new\_record? patches to ensure StoreModel works correctly with ActiveAdmin's form builders.
_lib/store\model/ext · high confidence
Added union type support for polymorphic attributes
The library now provides a \union\ method to create union types for polymorphic attributes, allowing users to define attributes that can be one of several classes based on a discriminator value. This feature includes validation to ensure all specified classes have the required discriminator attribute set and that discriminator values are unique, raising clear errors for missing or duplicate configurations.
lib · high confidence
StoreModel 4.6.1 introduces enums, nested attributes, and configuration options
This release upgrades the library to version 4.6.1, introducing several new capabilities and configuration options. Users can now define Rails-like enums with \enum\ support, including custom prefixes, suffixes, and invalid value handling. Nested attributes are now fully supported via \accepts\_nested\_attributes\_for\, allowing for \allow\_destroy\ and \update\_only\ behaviors on StoreModel attributes. The library also adds a new configuration system with options to control error merging strategies (\merge\_errors\, \merge\_array\_errors\, \merge\_hash\_errors\), serialization of unknown and empty attributes, enum serialization in \as\_json\, parent tracking, and ActiveAdmin compatibility. Additionally, the old \JsonModelType\ has been removed in favor of a more robust type system (\Types::One\, \Types::Many\, etc.), and various convenience methods like \from\_value\, \fetch\, and bracket access (\\[\]\) have been added to the model interface.
_lib/store\model · high confidence
Behavioural changes
Introduces dedicated type system for serialization, polymorphism, and enums
The \lib/store\_model/types\ directory now contains a comprehensive set of \ActiveModel::Type::Value\ implementations that define how StoreModel data is cast, serialized, and deserialized. This includes \EnumType\ for handling Rails-like enums with configurable invalid-value behavior, \One\, \Many\, and \Hash\ types for standard single, collection, and key-value storage, and corresponding \\*Polymorphic\ variants (\OnePolymorphic\, \ManyPolymorphic\, \HashPolymorphic\) that allow dynamic model resolution via a wrapper proc. The implementation also introduces \OneOf\ as a factory for these polymorphic types and \RawJSONEncoder\ to prevent duplicate JSON serialization on nested objects, fundamentally changing how store model attributes interact with the database and JSON payloads.
_lib/store\model/types · high confidence
Refined error merging strategies for StoreModel attributes
The error combination logic for StoreModel attributes has been updated to provide more granular control and better compatibility with Rails 6.1+. A new MergeArrayErrorStrategy now prefixes errors with array indices (e.g., "\[0\] error message") when merging errors from an array of models, while a new MergeHashErrorStrategy prefixes errors with hash keys. The existing MergeErrorStrategy has been rewritten to handle Rails 6.1+ differently, adding errors to the parent attribute with full messages instead of using the deprecated \copy!\ method, and the MarkInvalidErrorStrategy now attaches the child model's errors object to the parent attribute for more detailed validation feedback. Additionally, the module namespace was corrected from \CombileErrorsStrategies\ to \CombineErrorsStrategies\.
_lib/store\_model/combine\_errors\strategies · high confidence
StoreModelValidator now validates JSON, Array, and Hash attribute types
The StoreModelValidator has been updated to support validation of attributes typed as JSON, Array, and Hash (including polymorphic variants). Previously, it only handled basic StoreModel attributes; now it delegates to specific strategies for each type, ensuring that invalid elements in arrays or hashes are properly detected and merged into the parent record's errors, while also respecting the validation context.
_lib/active\model · high confidence
Test coverage
Added comprehensive tests for StoreModelValidator behavior; Added test configuration for parent assignment feature; Added test coverage for store model type casting and serialization; Added test fixtures and updated Configuration model for spec/dummy; Added tests for array error merging and fixed class name typo in error strategy specs; Benchmark for \_read\_attribute parent assignment optimization; Expanded test coverage for StoreModel features; Updated dummy database schema for test fixtures; Updated test configuration for enum serialization and JRuby compatibility.
Dependencies
Expanded CI support for Rails 7.2, 8.0, 8.1, and JRuby
The gemfile configuration for continuous integration has been updated to test against newer versions of the Rails framework and the JRuby runtime. New gemfiles have been added to support Rails 8.0 and 8.1, while the existing configuration for Rails 5.2 has been renamed and upgraded to target Rails 7.2. Additionally, a dedicated gemfile for JRuby has been introduced to ensure compatibility with that platform, and the master branch configuration now explicitly targets the 'main' branch of the Rails repository.
gemfiles · high confidence
Upgrade to Ruby 3.0+ and ActiveRecord 7.0
The gem now requires Ruby 3.0 or higher and depends on ActiveRecord 7.0 or higher, dropping support for older Ruby and Rails versions. The SQLite3 dependency has been updated to version 1.7.0, and the Rubocop development dependency is pinned to version 1.65.1.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 63 → 64 (+0.9)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.
Lenses
- Code Health 62 → 58 (-3.4)
- Architecture 97 → 97 (+0.0)
- Maturity 54 → 58 (+3.8)
- Readiness 67 → 67 (+0.1)
- Security 98 → 97 (-0.9)
- Domain Modelling 100 → 100 (+0.0)
- Performance 85 → 85 (+0.0)
Resolved (3)
- Configuration properties are duplicated between the global Configuration class and instance-level boolean check methods on Model. While one is global config and the other is instance-level resolution, the naming pattern serialize_* vs serialize_*? is inconsistent. The Model methods act as getters for the configuration, but the presence of both global setters and instance checkers without a clear unified accessor pattern (e.g., config.serialize_unknown_attributes) adds cognitive load.
- Off-boarding risk: anonymized user #1
- Outdated: activerecord
New (2)
- Off-boarding risk: anonymized user #1
- Orphaned file (benchmark/read_attribute_benchmark.rb)
Changes since last survey
- 3 commits — 2 feature/other, 1 fixes
By area
- (root) — 2 commits
- lib/store_model — 1 commit
Notable commits
- fix: Fix PR number for the as_json entry in CHANGELOG
- change: Avoid repeated casts when stored models have unknown attributes (#240)
- change: Update CHANGELOG with PR #240
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
DmitryTsepelev/store_model was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 6 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit b48f150c6b580dd89e5abfe3323e48376d5da44a — the exact code this score is about.
- Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.2+preprod-5c4e66d9318b.