Rails 3.2 Postgres Save Error “ActiveRecord::StatementInvalid: PG::Error: ERROR: Syntax error near 'T' at position 5”

前端 未结 1 2054
野性不改
野性不改 2020-12-18 21:16

My app has started throwing errors when I try to save a particular class to the database. I\'m not sure exactly what caused this to start happening - I\'ve been having all

相关标签:
1条回答
  • 2020-12-18 22:00

    I just had a similar problem, on Rails 3.2. If you're not using Rails trunk (working towards 4.0), it doesn't understand the hstore natively - you need to define a serialization coder (which is provided by the activerecord-postgres-hstore gem), like so:

    class Example < ActiveRecord::Base
      serialize :data, ActiveRecord::Coders::Hstore
    end
    
    0 讨论(0)
提交回复
热议问题