{"id":19028387,"url":"https://github.com/zinovyev/validacity","last_synced_at":"2026-05-02T00:30:29.806Z","repository":{"id":59159039,"uuid":"151469224","full_name":"zinovyev/validacity","owner":"zinovyev","description":"Validation objects for Rails","archived":false,"fork":false,"pushed_at":"2018-11-30T10:36:14.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-03T15:52:49.096Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zinovyev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-03T19:33:29.000Z","updated_at":"2018-11-30T10:36:15.000Z","dependencies_parsed_at":"2022-09-13T20:11:35.117Z","dependency_job_id":null,"html_url":"https://github.com/zinovyev/validacity","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zinovyev%2Fvalidacity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zinovyev%2Fvalidacity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zinovyev%2Fvalidacity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zinovyev%2Fvalidacity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zinovyev","download_url":"https://codeload.github.com/zinovyev/validacity/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240079610,"owners_count":19744720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T21:10:57.417Z","updated_at":"2026-05-02T00:30:29.739Z","avatar_url":"https://github.com/zinovyev.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Validacity\n\nMove validation definitions out of you models and form objects.\n\n## Usage\n\nYou can apply multiple sets of validation rules on-fly,\nremove any them if not needed and re-validate object against\nnew rules afterwards.\n\nBy the way, the validation errors will be putten to the object\nso all your view helpers will be available to display the error list.\n\nThis approach will suitable if you need to validate different states\nof the same object differently. Say you're using a state machine\nand each state has it's own field set and the fields from the other\nsatates shouldn't be validated at this time.\n\nOr perhaps you just have to many constructions like\n`validate :blablabla, presence: true` in your model class and you want to\nget rid of it so you can focus on buisiness logic.\n\nYou can add a concern to your model so it becomes **validatable**:\n\n```ruby\n\n# app/models/user.rb\n\nclass User\n  include Validacity::Validatable\n  validations :user_personal_data\nend\n\n```\n\nOr you can add it directly to your object:\n\n```ruby\n\nuser = User.new\nuser.validations :user_personal_data\n\n```\n\n\nGenerate new validation:\n\n```bash\n\n$ bundle exec rails g validacity:validation UserPersonalData\n\n```\n\n```ruby\n\n# app/validations/user_personal_data_validation.rb\n\nclass UserPersonalDataValidation\n  validate :name, presence_of: true\n  # ...a ton of different validations\nend\n\n```\n\nNow let's try to validate your user object:\n\n\n```ruby\n\nuser = User.new\n\nuser.valid? # =\u003e false\n\nuser.name = \"John\"\n\nuesr.valid? # =\u003e true\n\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\n\ngem 'validacity'\n\n```\n\nAnd then execute:\n\n```bash\n\n$ bundle\n\n```\n\nNow run the validation installation command:\n\n```bash\n\n$ bundle exec rails g validacity:install\n\n```\n\nAnd the event validation:\n\n```bash\n\n$ bundle exec rails g validacity:validation Event\n\n```\n\n## Contributing\n\nContribution directions go here.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzinovyev%2Fvalidacity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzinovyev%2Fvalidacity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzinovyev%2Fvalidacity/lists"}