Search code examples
ruby-on-railspostgresqlruby-on-rails-4activerecordpg

Date compare with rails 4 + pg column not existe


Got a strange problem in my app.

I need to compare a date column.

If I try

testing =  Accessibility.where(:DatAccsBegn => Date.today)

it works fine, but I need to do a <= So if I try

testing =  Accessibility.where("DatAccsBegn <= ?", Date.today)

Got an error "column "dataccsbegn" does not exist"

Any idea ?


Solution

  • So, I renamed all column in my database.

    With Postgreql, column are case insensitive, except if they are quoted, but if you quote, you lose column type.

    So, i renamed my column to respect standards like dat_accs_begn and it works.