Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ID columns contain nil #33

Open
hle-skillz opened this issue Oct 15, 2019 · 0 comments
Open

ID columns contain nil #33

hle-skillz opened this issue Oct 15, 2019 · 0 comments

Comments

@hle-skillz
Copy link

hle-skillz commented Oct 15, 2019

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?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant