ledermann/rails-settings
65.9
Adequate · 20 September 2026
251
lines of production code
Ruby
primary language
1
measurement over time
What this system is
This system is a Ruby gem that provides a model-specific DSL for storing and managing dynamic settings within ActiveRecord models. It replaces a legacy global singleton pattern with a scoped, instance-level approach, allowing developers to define typed settings with defaults and validation. The library handles the underlying database schema and serialization, ensuring data integrity while supporting modern Rails versions.
Features
Added migration generator for Rails Settings
A new generator class \RailsSettings::MigrationGenerator\ has been introduced to create the \rails\_settings\_migration.rb\ file in the \db/migrate\ directory. This generator supports both timestamped and non-timestamped migration naming conventions by checking the \ActiveRecord\ configuration, allowing users to easily scaffold the necessary database migration for the library.
_lib/generators/rails\settings/migration · high confidence
Behavioural changes
Rails Settings gem restructured into modular components with Rails 7.1 serialization support
The lib/rails-settings library has been refactored from a single monolithic file into distinct modules (Base, Configuration, Scopes, SettingObject) to improve maintainability and clarity. This change introduces a new Configuration DSL for defining settings and adds explicit support for Rails 7.1+ by using the modern \serialize :value, type: Hash\ syntax instead of the deprecated \serialize :value, Hash\. The gem version is updated to 2.6.2, and the SettingObject now includes validation to ensure only defined setting keys are used, enhancing data integrity for users storing dynamic attributes.
lib/rails-settings · high confidence
Rails Settings gem rewritten for modern Ruby and Rails versions
The gem has been completely rewritten (Version 2) to require Ruby 3.2+ and support Rails 6.1 through 8.0, dropping all older versions. This introduces a new DSL for defining settings (e.g., \has\_settings do \|s\| ... end\) and a new database schema, though existing data from Version 1 remains compatible. The old plugin-style interface (\init.rb\, \README\) has been removed in favor of a standard gem structure with a new \README.md\ and \.gitignore\.
(repo-wide) · high confidence
Rails Settings plugin restructured into modular gem with new API
The library has been refactored from a single monolithic \Settings\ class into a modular gem structure (\rails-settings\). The old global \Settings\ class and its \method\_missing\-based API (e.g., \Settings.foo\, \Settings.destroy(:foo)\) have been removed. Instead, settings are now defined per-ActiveRecord model using the \has\_settings\ macro, which injects \RailsSettings::Base\ and \RailsSettings::Scopes\. This change introduces a scoped, instance-level approach to storing settings, requiring users to migrate from the previous global singleton pattern to the new model-specific DSL.
lib · high confidence
Updated migration template to use Rails 5.0 syntax
The migration generator template now uses the versioned ActiveRecord::Migration\[5.0\] class syntax, ensuring compatibility with Rails 5.0 and later. The generated migration creates a 'settings' table with 'var', 'value', and polymorphic 'target' columns, along with a unique index on the target and variable fields.
_lib/generators/rails\settings/migration/templates · high confidence
Test coverage
Added comprehensive test suite for Rails Settings configuration and behavior; Added test helpers to count ActiveRecord SQL queries; Removal of Settings plugin unit tests.
Dependencies
Expanded CI support for Rails 6.1 through 8.0
The project now includes dedicated Gemfiles to test compatibility with Rails versions 6.1, 7.0, 7.1, 7.2, and 8.0. This change ensures the library functions correctly across a wide range of ActiveRecord versions, with specific updates such as requiring SQLite3 version 2.1 or higher for Rails 8.0.
gemfiles · high confidence
Initial gem release with Ruby 3.2+ and Rails 6.1+ requirements
The project is now packaged as a Ruby gem (rails-settings) with a Gemfile and gemspec. It requires Ruby 3.2 or later and depends on ActiveRecord 6.1 or later. Development dependencies include rake, sqlite3, rspec, coveralls\_reborn, and simplecov (\>= 0.11.2).
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 66.
Lenses
- Code Health 100
- Architecture 69
- Maturity 59
- Readiness 58
- Security 100
- Domain Modelling 100
Changes since last survey
- 300 commits — 259 feature/other, 41 fixes
By area
- (root) — 143 commits
- lib/rails-settings — 57 commits
- (repo) — 13 commits
- lib/app — 10 commits
- lib/settings.rb — 10 commits
- test/settings_test.rb — 10 commits
- lib/rails-settings.rb — 7 commits
- .github/workflows — 6 commits
- lib/generators — 6 commits
- ci/Gemfile-rails-5-0 — 5 commits
- ci/Gemfile-rails-3-1 — 4 commits
- spec/setting_object_spec.rb — 4 commits
- spec/settings_spec.rb — 4 commits
- test/test_helper.rb — 4 commits
- generators/settings_migration — 3 commits
- spec/spec_helper.rb — 3 commits
- doc/classes — 2 commits
- gemfiles/rails_7_1.gemfile — 2 commits
- spec/support — 2 commits
- ci/Gemfile-rails-6-0 — 1 commit
Notable commits
- fix: CI: Use gem "coveralls_reborn" to fix coverage errors
- fix: Compatibility fix for Rails 3.1
- fix: Destroying false values (thanks to @Pavling), fixes #10
- fix: Fix NoMethodError on Rails 7.x (#114)
- fix: Fix Rails 3 compatibility
- fix: Fix compatibility with Rails 4
- fix: Fix mutable default settings bug (#109)
- fix: Fix serialize type deprecation warning on Rails 7.1+ (#113)
- fix: Fix setting object method regex (#107)
- fix: Fix testing on Ruby 1.9
- fix: Fix tests with older Rails on Ruby 3.2 or newer
- fix: Fix to use [] and []= on scoped settings, too
- fix: Fixed "active_support" dependency
- fix: Fixed #update_settings! when there are no settings loaded yet
- fix: Fixed bug with "Settings.destroy(:foo)" that was always raising an error.
- fix: Fixed gemspec
- fix: Fixed generator
- fix: Fixed naming conflict: Renamed "object_id" and "object_type" to "target_id" and "target_type". ATTENTION: Needs migration!
- fix: Fixed running tests
- fix: Fixed syntax error
- …and 280 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
ledermann/rails-settings 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 20 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 14d36886b2f5b375f09ae90d82631d9ab5443c35 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-b51f968c9b10.