FuhenRecord
FuhenRecord is a Rails extension that makes ActiveRecord models immutable.
There are already a bunch of gems on RubyGems that do similar things. I just couldn’t find one that felt actively maintained, so I made this.
(That said, I can’t guarantee this gem will stay well-maintained forever.)
Installation
Add this line to your application's Gemfile:
gem "fuhen_record"And then execute:
$ bundleUsage
To make your model immutable, add immutable_record like this:
class AccessLog < ApplicationRecord
immutable_record
endContributing
Contribute however you like.
AI-generated contribution guide, just in case:
- Fork the repository
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
License
The gem is available as open source under the terms of the MIT License.