Sha256: fb6b2d29090803bff01665fcada120c93d9d1c8a186b40a49cbad030ed63aeb3

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

= couchrest-uniqueness-validation

Validates that the specified attribute is unique across documents with the same 
couchrest-type using a view.

@note
  You have to define a design doc view.
@see http://rdoc.info/rdoc/couchrest/couchrest/blob/1b34fe4b60694683e98866a51c2109c1885f7e42/CouchRest/Mixins/Views/ClassMethods.html#view_by-instance_method for more details about views.

@example [Usage]

  class User
  
    property :nickname
    property :login

    view_by :nickname

    # assumes that a view :by_nickname is present
    validates_uniqueness_of :nickname

    # uses a different from default view 
    validates_uniqueness_of :login, :view => 'my_custom_view'

    # a call to valid? will return false unless no other document exists with
    # the same couchrest-type, nickname and login
  end

== Note on Patches/Pull Requests
 
* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so I don't break it in a
  future version unintentionally.
* Commit, do not mess with rakefile, version, or history.
  (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
* Send me a pull request. Bonus points for topic branches.

== Copyright

Copyright (c) 2010 alex@digns.com. See LICENSE for details.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
couchrest-uniqueness-validation-0.0.1 README.rdoc