Ruby memory, ActiveRecord and Draper

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 #activerecord https://rubyonrails.ba/single/ruby-memory-activerecord-and-draper

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles