我在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,而是想在我的应用程序中覆盖它并在那里修改它。我该怎么做呢?
发布于 2013-07-20 17:45:51
尝试将以下内容放入config/initializers中:
StaticPage.module_eval do
def self.remove_spree_mount_point(path)
# overwrite...
end
endhttps://stackoverflow.com/questions/17760522
复制相似问题