
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
DataValidator is validation everywhere.
For Example, Controller or else.
params = {foo: 'foo', bar: 'bar'}
validator = DataValidator::Validator.new(
params,
{foo: {length: {is: 4}}},
{bar: {presence: true, format: {with: /\A[a-zA-Z]+\z/}}}
)
unless validator.valid?
@errors = validator.errors
end
@errors
=> {
foo: ["is the wrong length (should be 4 characters)"],
bar: ["can't be blank", "is invalid"]
}
DataValidator has almost AR validation logics by default.
DataValidator supports i18n.
If you use rails, you not worry about locale file.
Ex)
# encoding: UTF-8
module DataValidator
class TestValidator < BaseValidator
def validate
if options && values !~ /[^@]+$/
error_add :invalid_test, test: value
end
end
end
end
BaseValidator set accessors below.
Please see test case.
An error message subject uses "datavalidator.attribute.#{name}" in i18n locale file or name.
Add this line to your application's Gemfile:
gem 'data_validator'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install data_validator
require 'data_validator'
git checkout -b my-new-feature
)git commit -am 'Added some feature'
)git push origin my-new-feature
)Copyright (c) 2012- HARUAYMA Makoto (SpringMT)
MIT (see MIT-LICENSE)
FAQs
Unknown package
We found that data_validator 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
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
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.