No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
Checks for uniqueness vaidation in nested attributes for objects in memory .
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 3.2.0
>= 1.5
~> 0.8.2
~> 10.0
~> 3.3.0
 Project Readme

NestedAttributesUniqueness

This gem provides two class methods validates_uniqueness_in_memory and validates_uniqueness_in_memory_for_tree_polymorphism which ensures that the nested attribute uniqueness validation is not only checked against DB records but also against the non-persisted objects in memory.

Installation

Add this line to your application's Gemfile:

gem 'nested_attributes_uniqueness', '~> 1.0.1'

And then install dependencies using bundler:

$ bundle

Or install it as system gem:

$ gem install nested_attributes_uniqueness

Usage

For ActiveRecord:

  class User < ActiveRecord::Base
    include NestedAttributesUniqueness

    has_many :posts

    validates_uniqueness_in_memory :posts, :name, { scope: user_id, case_sensitive: false }
  end

Testing

$ bundle
$ bundle exec rspec spec

Contributing

1. Fork it ( https://github.com/vinsol/nested_attributes_uniqueness/fork ).
2. Create your feature branch (`git checkout -b my-new-feature`).
3. Add test cases and verify all tests are green.
4. Commit your changes (`git commit -am 'Add some feature'`).
5. Push to the branch (`git push origin my-new-feature`).
6. Create new Pull Request.