No commit activity in last 3 years
No release in over 3 years
Rails 3 Validator, that prevents attributes from being changed to a blank value once they're present.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

PreventBlankificationValidator

Build Status Code Coverage Code Climate Gem Version Dependency Status

Rails 3 Validator, that prevents attributes from being changed to a blank value once they're present.

Installation

Add this line to your application's Gemfile:

gem 'prevent_blankification_validator'

And then execute:

$ bundle

Or install it yourself as:

$ gem install prevent_blankification_validator

Usage

class MyModel
  validates :value, prevent_blankification: true
end

model.value = 'present'
model.save             # => true

model.value = ''
model.valid?           # => false

model.value = "\r    \n  "
model.valid?           # => false

model.value = nil
model.valid?           # => false

model.value = 'present as well'
model.valid?           # => true

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request