#18 open
tset

if_attribute nil requires special sql syntax

Reported by tset | August 20th, 2009 @ 09:23 AM

if_attribute :access => nil
and
if_attribute :access => is nil
now generates sql like this:
SELECT * FROM pages WHERE (pages.access = NULL)
but should generate sql like this:
SELECT * FROM pages WHERE (pages.access IS NULL)

Comments and changes to this ticket

  • tset

    tset August 20th, 2009 @ 09:30 AM

    Ah my line breaks got eaten.. New attempt:

    if_attribute :access => nil
    and
    if_attribute :access => is nil
    now generates sql like this:
    SELECT * FROM pages WHERE (pages.access = NULL)
    but should generate sql like this:
    SELECT * FROM pages WHERE (pages.access IS NULL)

  • Steffen Bartsch

    Steffen Bartsch August 20th, 2009 @ 10:51 AM

    • State changed from “new” to “open”

    That's certainly the case. I'm happy to accept a patch on this issue.

  • Steffen Bartsch

    Steffen Bartsch August 20th, 2009 @ 10:54 AM

    On second thought: this issue should be solved already. There is a test case "test_named_scope_with_is_nil" in model_test.rb. Isn't that one applicable to your issue? Could you provide a failing test?

  • tset

    tset August 20th, 2009 @ 11:44 AM

    When you run that test case, can you see what SQL is being generated? Because for me, the generated SQL is "access = NULL"

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

By now, decl_auth is using the GitHub issue tracker as well. Please use the one over there: http://github.com/stffn/declarative_authorization/issues

People watching this ticket

Pages