
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
validates_immutability
Advanced tools
= ValidatesImmutability
Validations for making ActiveRecord objects immutable.
== Examples
class Person < ActiveRecord::Base
immutable :unless => :can_change?, :message => "I don't like being changed."
def can_change?
true
end
end
> p = Person.first
> p.plays = "soccer"
> p.valid?
=> false
> p.errors
=> {:base=>["I don't like being changed."]}
class Car < ActiveRecord::Base
validates :color, :immutable => {
:if => lambda { !color_can_change? },
:message => "is beautiful already."
}
def color_can_change?
false
end
end
> c = Car.first
> c.color = "red"
> c.valid?
=> false
> c.errors
=> {:color=>["is beautiful already."]}
== Note on Patches/Pull Requests
== Copyright
See LICENSE for details.
FAQs
Unknown package
We found that validates_immutability demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.