hawm
(Hawm)
16 בפברואר, 2021, 5:44am
2
No, you override class/method rather a file, so filename may dosn’t matter. If you don’t know about the plugin structure you can read some offical plugin source code.
I’ve been running into a bunch of instances recently of needing to override existing ruby methods from plugins, and thought I’d share my best practices here.
Overriding an instance method
class ::TopicQuery
module BabbleDefaultResults
def default_results(options={})
super(options).where('archetype <> ?', Archetype.chat)
end
end
prepend BabbleDefaultResults
end
Here I’m removing chat topics from an instance method which is returning a list of topics.
The module name BabbleD…