Search code examples
ruby-on-railsruby-on-rails-3refinerycms

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


I'm using refinerycms v 1.0.9 in my project.

When I opening pages which contain images I get an error:

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

As I understood method escape_path included in Rack versions newer than mine. My refinery version is using Rack 1.2.8 and I can't update Rack version because in this case Refinery fails.

I believe I've missed something important. How can I solve my problem?

Thanks


Solution

  • I haven't found any solution and I tried to expand old Rack::Utils module with missing method.

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

    I added it to config/initializers