It sounds like the object you’ve called .id
on is not actually an ActiveRecord model. You should only see that warning for Ruby objects where .id
is the soon-to-be deprecated version of Object#object_id
.
However, another way to access the primary key for the field with an ActiveRecord model is model.attributes['id']
so you could try that.