Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validates_uniqueness with scope problem #132

Closed
jmaniv opened this issue Jul 13, 2011 · 2 comments
Closed

validates_uniqueness with scope problem #132

jmaniv opened this issue Jul 13, 2011 · 2 comments

Comments

@jmaniv
Copy link

jmaniv commented Jul 13, 2011

Hi,

   I am using postgresql database with active column in users table

i have set default value for active column as true. its value is '1'

user's model validations like:
validates :name, :uniqueness => { :scope => :active, :message => "Already exists" }

My validations are pass, even having same name with active column as 'true'

I inspect using firebugs, got parameter like scope[active] = 0.

Hope '0' as 'FALSE', So it looks name with 'FALSE' status.

@kroofy
Copy link

kroofy commented Sep 12, 2011

I think I'm seeing a similar issue.

In my model:
validates_uniqueness_of :email, :scope => :entry_date, :message => "Already exists"

The request:
Request URL: http://myapp.dev/validators/uniqueness?case_sensitive=true&scope%5Bentry_date%5D=null&contestant%5Bemail%5D=myemail%40gmail.com Request Method: GET Status Code: 404 Not Found

Only response is "true", regardless of previous entries on the same date.

Update: Just did a test, when removing the :scope everything works fine.

@bcardarella
Copy link
Contributor

@kroofy I believe your issue was fixed in c2483c6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants