I’m accessing a rails model with the typical primary key id. However, when I access it in a method, I get the following warning.
Object#id will be deprecated; use Object#object_id
It seems it’s getting confused between object id, and the primary key for the model. is there a way to make sure its using the field id?
It sounds like the object you’ve called
.idon is not actually an ActiveRecord model. You should only see that warning for Ruby objects where.idis the soon-to-be deprecated version ofObject#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.