Skip to content

ID columns contain nil #33

@hle-skillz

Description

@hle-skillz

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions