validates_serialized
validates_serialized copied to clipboard
Validation helpers for serialized ActiveModel attributes
I encountered a situation where I needed to give a validation on a serialized Hash access to the outer, "real" object - for instance, validations conditional on some state of...
Previous to this commit the following would fail silently: ``` validates_hash_keys :hash do validates :key, presence: true, if: :if_method end def if_method false end ``` This PR allows us to...
Is it possible to use a [conditional validation](http://edgeguides.rubyonrails.org/active_record_validations.html#conditional-validation) with validates_serialized gem ? If not, I am able to contribute with it.
the method in [validating-a-serialized-array-syntax-1](https://github.com/brycesenz/validates_serialized#validating-a-serialized-array-syntax-1) should be `validates_array_values`
If I have a nested validation: ``` serialize :data, Hash validates_hash_keys :data do validates :url, presence: true, if: Proc.new{|f| f.required_data_field?(:url) } end ``` The f in the Proc won't be...