Ruby memory, ActiveRecord and Draper
25-Jan-2019 2231
Christophe Maximin (thanks a lot, Christophe) came with this answer:(Wild guess by just reading the AR code) Because if the same user (same primary key) is already in users, it just replaces that old object with the new object you’re passing with <<, which is why it needs to know the index of the old one. And to know if records are the same, it needs to call ==.If you want a full example of how it is called, you can use TracePoint. Without and with having == in Integer:.
Ruby memory, ActiveRecord and Draper #ruby #rubydeveloper #rubyonrails #memory, #ActiveRecord #Draper #activerecord https://www.rubyonrails.ba/link/ruby-memory-activerecord-and-draper