Leverage Regular Instance Variable to Resolve Thread-Safety Issue on Rails ActiveRecord model

Owing to the superpowers of the Rails ActiveRecord module, developers can sometimes forget that, under the hood, our AR models are just regular Ruby objects. This allows us to make use of standard instance variables on the objects to adapt their behaviour, which can be useful in particular cases. In this post we discuss the technique and give an example of where it could be used.
Leverage Regular Instance Variable to Resolve Thread-Safety Issue on Rails ActiveRecord model #ruby #rubydeveloper #rubyonrails #activerecord #thread-safety

Nezir Zahirovic

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

related articles