我在Rails Gem的routes.rb中有这个模块:
module StaticPage
def self.remove_spree_mount_point(path)
regex = Regexp.new '\A' + Rails.application.routes.url_helpers.spree_path
path.sub( regex, '').split('?')[0]
end
end
我需要修改它,但我不想直接编辑Gem,而是想在我的应用程序中覆盖它并在那里修改它。我怎么能这样做?
答案 0 :(得分:0)
尝试在config / initializers中添加以下内容:
StaticPage.module_eval do
def self.remove_spree_mount_point(path)
# overwrite...
end
end