ROM::Model
This is a set of extensions for PORO objects to help in data coercion and validation. It was extracted from rom-rails and for now it uses Virtus and ActiveModel.
The package includes:
ROM::Attributesfor defining input attributes with types and coercion rulesROM::Validatora standalone validator object extension built on top ofActiveModel::Validationswith additional features like nested validators
The Plan™
This gem is built on top of existing 3rd party gems that have proven to be stable and good-enough. Unfortunatelly neither Virtus nor ActiveModel do not meet certain design requirements to be a good fit in the long term.
For that reason we're exploring how to build a better foundation for rom-model. Specifically following initiatives are taking place:
- Exploring a lower-level validation library with great composability features and simple interface
- Investigating a lower-level input data sanitization/coercion library that would be a perfect fit for handling web forms and json input
Furthermore rom-model will be soon extended with a third extension for defining Algebraic Data Types which will work remarkably well with rom-repository and its auto-mapping features.
This project will provide convenient interfaces on top of robust lower-level tools and if it turns out to be too big we'll split it into smaller gems.
Installation
Add this line to your application's Gemfile:
gem 'rom-model'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rom-model
License
See LICENSE file.
