localytics / odbc_adapter

An ActiveRecord ODBC adapter
MIT License
46 stars 107 forks source link

ID columns contain nil #33

Open hle-skillz opened 5 years ago

hle-skillz commented 5 years ago

I'm using a simple User.first to load a row from Snowflake but the id always contains nil:

User.first
  # <User id:nil, username: "bob>

the underlying query is returning correct data though:

User.connection.exec_query('select * from user limit 1')
  # {:id => "5", :username => "bob" ...}

Doing a step-by-step object construction yields this error:

h = User.connection.exec_query('select * from user limit 1').to_a[0]
User.new(h)
# ActiveModel::MissingAttributeError: can't write unknown attribute `ID`
# from /Users/bob/.rvm/gems/ruby-2.4.2/gems/activerecord-5.1.7/lib/active_record/attribute.rb:205:in `with_value_from_database'-

Is this something specific to the id column that needs an initializer setting?