Problem
While Arkenstone checks for validity before saving a new object, it does not extend the same courtesy to existing objects being saved, and will happily try to save an invalid document.
How to reproduce?
Given a document (e.g. User) with a validation requirement (e.g. validates :email, presence: true)
-
Retrieve an already saved record
user = User.find some_valid_id
-
Set one of the attributes to an invalid value
-
For fun, make sure that it is indeed invalid
-
Now try to save it, and watch it go through (unless the API resource rejects it)
Problem
While Arkenstone checks for validity before saving a new object, it does not extend the same courtesy to existing objects being saved, and will happily try to save an invalid document.
How to reproduce?
Given a document (e.g.
User) with a validation requirement (e.g.validates :email, presence: true)Retrieve an already saved record
Set one of the attributes to an invalid value
For fun, make sure that it is indeed invalid
Now try to save it, and watch it go through (unless the API resource rejects it)