merefield
(Robert)
11 Novembre 2020, 10:11pm
6
Haha, beh, è un modo per farlo, ma in realtà dovresti aggiungerlo come opzione e dare sempre all’utente la possibilità di modificarlo… almeno se vuoi che venga integrato nel plugin
Comunque sì, ottimo lavoro, continua a evolverlo.
A proposito, dai anche un’occhiata a:
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…