Skip to content

6artisans/paranoia_uniqueness_validator

 
 

Repository files navigation

ParanoiaUniquenessValidator

Adds validator validates_uniqueness_without_deleted.

This validator will ignore any record that has a non-null value for the deleted_at field. This gem was made specifically for use with the Paranoia gem but it can be used with any gem that uses the deleted_at field for marking records as deleted.

Gem Version Build Status Dependency Status Coverage Status Code Climate

Installation

Add this line to your application's Gemfile:

# Rails 3
gem 'paranoia_uniqueness_validator', '0.1.0'

# Rails 4
gem 'paranoia_uniqueness_validator', '1.1.0'

And then execute:

$ bundle

Or install it yourself as:

$ gem install paranoia_uniqueness_validator

Configuration

This validator supports all configuration options used by the base ActiveRecord uniqueness validator. For more information check out the Rails API documentation.

Usage

class SomeModel < ActiveRecord::Base
    validates :some_field, :uniqueness_without_deleted => true
end

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

Credits

Sticksnleaves

paranoia_uniqueness_validator is maintained and funded by Sticksnleaves

Thanks to all of our contributors

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 79.4%
  • HTML 16.0%
  • JavaScript 2.5%
  • CSS 2.1%