Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
validation_reflection
Advanced tools
Version 1.0.0, 2010-10-08
This plugin adds reflective access to validations
Both of these methods return arrays containing instances of ActiveRecord::Reflection::MacroReflection. For example
class Person < ActiveRecord::Base validates_presence_of :name validates_numericality_of :size, :only_integer => true end
refl = Person.reflect_on_validations_for(:name) refl[0].macro
refl = Person.reflect_on_validations_for(:size) refl[0].macro
refl[0].options
== Customization
Usually, all the standard Rails validations are reflected. You can change this -- add or remove validations -- in an application-specific initializer,
config/initializers/validation_reflection.rb
In that file change config.reflected_validations to suit your needs. Say, you have a custom validation for email addresses, validates_as_email, then you could add it like this
config.reflected_validations << :validates_as_email
If validates_as_email is implemented in terms of other validation methods, these validations are added to the reflection metadata, too. As that may not be what you want, you can disable reflection for these subordinate validations
config.reflected_validations << { :method => :validates_as_email, :ignore_subvalidations => true }
You have to make sure that all reflected validations are defined before this plugin is loaded. To this end, you may have to explicitly set the load order of plugins somewhere in the environment configuration using
config.plugins = [...]
== Special Thanks
To Michael Schuerig, michael@schuerig.de for his initial concept and implementation of this plugin.
== License
ValidationReflection uses the MIT license. Please check the LICENSE file for more details.
FAQs
Unknown package
We found that validation_reflection 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.