I'm trying to overriding a helper method of base_helper.rb by using this:
module Spree
module BaseHelper.class_eval do
def taxons_tree(root_taxon, current_taxon, max_level = 1)
.....
end
end
end
It's not working for me. Anyone know what I am missing here?
Thank you!
Fixed:
I should use:
Spree::BaseHelper.module_eval do
def taxons_tree(root_taxon, current_taxon, max_level = 1)
...
end
end
instead.
Re-opening the module will work just as well:
module Spree
module BaseHelper
def taxons_tree(root_taxon, current_taxon, max_level = 1)
...
end
end
end
There's no particular reason to use class_eval
and module_eval
, it's just been the habit in the Spree project for a very long time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With