https://github.com/m1foley/validart
Proof of concept for client-side validations
https://github.com/m1foley/validart
Last synced: 3 months ago
JSON representation
Proof of concept for client-side validations
- Host: GitHub
- URL: https://github.com/m1foley/validart
- Owner: m1foley
- Created: 2013-07-05T19:51:12.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-07-06T21:49:04.000Z (almost 12 years ago)
- Last Synced: 2025-02-02T05:26:02.587Z (4 months ago)
- Language: Ruby
- Size: 141 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
validart
========Proof-of-concept for publishing a server's ActiveModel validations. Also an opportunity to play around with Rails 4 & Jbuilder.
Instructions
------------
- Install gems: `bundle`
- Run the server: `rails s`
- Simulate a client reading the server validations: `ruby client_sim.rb`Example output
--------------
Command: `curl http://localhost:3000/external_validations.json`Output:
[{"name":"User","validators":[{"class":"ActiveRecord::Validations::PresenceValidator","attributes":["name"],"options":{}},{"class":"ActiveModel::Validations::FormatValidator","attributes":["phone_number"],"options":{"with":"(?-mix:\\A\\(\\d{3}\\) \\d{3}-\\d{4}\\z)","allow_blank":true}},{"class":"ActiveModel::Validations::InclusionValidator","attributes":["status"],"options":{"in":["archived"],"allow_blank":true}}]},{"name":"ValidationlessObject","validators":[]}]