News for hackers. Stuff that matters.
Re:JIT and Ruby's MJIT by t-writescode on Friday December 06, 2019 @09:54PM (#21728162)
New Rails dev here: I believe the entire ActiveRecord model is constant monkey patching.
Re:JIT and Ruby's MJIT by FooBarWidget on Friday December 06, 2019 @10:13PM (#21728228)
Long time Rails dev here. I believe not. The Rails core devs have long known that monkey patching is not thread safe, and blows Ruby method caches, so they already reserve monkey patching for initialization time.
Re:JIT and Ruby's MJIT by thomasfedb on Saturday December 07, 2019 @01:42AM (#21728876)
I feel that the definition of "monkey patching" doesn't (or shouldn't) cover what Rails does in AR. Monkey patch suggests a change of behaviour over what was initially intended, however dynamic method generation in AR is very-much part of the intended API.

That said, there are plenty of Rails apps that do monkey patch Rails internals, for better or worse.

Re:JIT and Ruby's MJIT by toasterlovin on Friday December 06, 2019 @10:16PM (#21728235)
Do you have something specific in mind? From my understanding of ActiveRecord, most of the method generation should happen the first time the class is defined.
Re:JIT and Ruby's MJIT by viraptor on Saturday December 07, 2019 @03:41AM (#21729198)
Closer to the first time it's used. Schema gets queried and methods get added the moment you do the first query on the model normally.
Re:JIT and Ruby's MJIT by mperham on Saturday December 07, 2019 @09:26AM (#21730399)
This is not true in production, where eager loading is always on.