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

does_not_equal function does not work for nil #135

Open
ghazel opened this issue Nov 23, 2010 · 0 comments
Open

does_not_equal function does not work for nil #135

ghazel opened this issue Nov 23, 2010 · 0 comments

Comments

@ghazel
Copy link

ghazel commented Nov 23, 2010

The _equals function works for strings and nil, but the _does_not_equal function does not.

User.name_equals(x)

Submits either:

SELECT * FROM `users` WHERE (users.name = 'foo')

or:

SELECT * FROM `users` WHERE (users.name IS NULL)

Depending on whether x is "foo" or nil. This is correct. However this:

User.name_does_not_equal(x)

Submits either:

SELECT * FROM `users` WHERE (users.name != 'foo')

or:

SELECT * FROM `users` WHERE (users.name != NULL)

The later of which is incorrect. It should be users.name IS NOT NULL.

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

1 participant