【问题标题】:RefineryCMS - undefined method `escape_path' for Rack::Utils:ModuleRefineryCMS - Rack::Utils:Module 的未定义方法“escape_path”
【发布时间】:2015-09-10 11:09:32
【问题描述】:

我在我的项目中使用refinerycmsv 1.0.9

当我打开包含图片的页面时出现错误:

NoMethodError in Admin/images#index

Showing /usr/local/rvm/gems/ruby-1.9.3-p448@fairy/gems/refinerycms-images-1.0.9/app/views/admin/images/_grid_view.html.erb where line #4 raised:

undefined method `escape_path' for Rack::Utils:Module

据我了解,方法escape_path 包含在比我更新的机架版本中。我的炼油厂版本正在使用 Rack 1.2.8,我无法更新 Rack 版本,因为在这种情况下炼油厂会失败。

我相信我错过了一些重要的事情。我该如何解决我的问题?

谢谢

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 refinerycms


    【解决方案1】:

    我还没有找到任何解决方案,我尝试使用缺少的方法扩展旧的 Rack::Utils 模块。

    require 'rack/utils'
    
    module Rack
      module Utils
        def escape_path(s)
          escape(s).gsub('+', '%20')
        end
        module_function :escape_path
      end
    end
    

    我添加到config/initializers

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多