Repository is archived
No commit activity in last 3 years
No release in over 3 years
A Rails validator for immutable attributes.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0
>= 0

Runtime

 Project Readme

activemodel-immutable_validator

Build Status Code Climate Coverage Status

Validate immutable attributes.

Usage

Add to your Gemfile:

gem 'activemodel-immutable_validator'

Run:

bundle install

Then add the followng to your model which belongs to a user:

validates :attr, immutable: true

Sample

A human cannot become a bot vice versa.

class User < ActiveRecord::Base
  validated :type, immutable: true
end

class Bot < User
end

class Human < User
end