On Sep 15, 2013, at 5:48 AM, Nicolas Mauchle <
nmau...@gmail.com> wrote:
> Postgres is case sensitive! So why does Rails convert saleStartDate to salestartdate in a scope?
You misunderstand postgres. It implements the case insensitivity required by SQL standards via a bit of a kludge--downcasing all identifiers that are not quoted.
I'd bet this would have worked:
scope :activeDate, -> { active.where('? BETWEEN "saleStartDate" AND "saleEndDate"', Date.today)}
> Is it best practice to use _ and not CamelCase in scopes?
Well, I don't know that I want to say "best practice" because I *like* using mixed case in my schemas, and I have a lot of legacy tables that way, but with postgres in particular is sure as heck would be *easier* to use all lower case ;-)
--
Scott Ribe
scott...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice