Sha256: 02371b8a781b25719409966a984f5ae7f57faa68c7c2d6fc96dd01b39d088e42
Contents?: true
Size: 676 Bytes
Versions: 1
Compression:
Stored size: 676 Bytes
Contents
## Conditionally nullify attributes. [](https://badge.fury.io/rb/nullify-attr) ## About Allows to conditionally (support both `if` and `unless`.) nullify attributes in `before_validation` hook. ## Usage ```ruby class Post < ActiveRecord::Base # Store description as NULL when description is blank. nullify :description, unless: :description? end class Payment < ActiveRecord::Base # We don't want to store bank card vendor when payment method isn't bank card. nullify :bank_card_vendor, unless: :paid_using_bank_card? end ``` ## Installing gem Add to your Gemfile: ```ruby gem 'nullify-attr', '~> 1.0' ```
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nullify-attr-1.0.0 | README.md |