ruby on rails - What is the difference with find_by() from the core and the one from the FinderMethods? -


currently i'm working on gem, overrides activerecords where. working on that, stumbled on 2 different find_by implementations. 1 in core , uses kind of cache, whereas 1 findermethods module calls where directly. difference between these 2 implementations? when used?

i think it's way: when use this:

user.find_by(...) 

the activerecord::core#find_by called, core included base inherit.

but if like:

user.first.products.find_by(...) 

the activerecord::relation (includes findermethods here) call findermethods#find_by

i don't know why implemented that, i'm sure there's reason this.


Comments