Skip to content
This repository
Browse code

Add scoped uniqueness example to README

I keep hitting Google for the exact syntax of this.
  • Loading branch information...
commit 671c0ec5bbd2b0765820137a79192cac734e3601 1 parent a228e0e
Paweł Gościcki pjg authored

Showing 1 changed file with 1 addition and 0 deletions. Show diff stats Hide diff stats

  1. +1 0  README.md
1  README.md
Source Rendered
@@ -27,6 +27,7 @@ Matchers to test validations and mass assignments:
27 27
28 28 describe Post do
29 29 it { should validate_uniqueness_of(:title) }
  30 + it { should validate_uniqueness_of(:title).scoped_to(:user_id, :category_id) }
30 31 it { should validate_presence_of(:body).with_message(/wtf/) }
31 32 it { should validate_presence_of(:title) }
32 33 it { should validate_numericality_of(:user_id) }

0 comments on commit 671c0ec

Please sign in to comment.
Something went wrong with that request. Please try again.