2013-10-10 49 views
0

我的MIME类型定义Rails的缓存保存的文件与扩展名错误

Mime::Type.register "text/html", :demo 

和控制器,它看起来像这样:

caches_page :show 
    def show 
    ..... 
    render_location 
    end 

    def render_location 
    ... 
    respond_to do |format| 
     format.html { 
     expires_in 3.days, :public=>true 
     } 
     format.demo { 
     headers['Content-type'] = 'text/html' 
     render 'fields.html.erb', layout:nil 
     } 
     format.json do 
     out = { 
      :promo_text => 'text', 
      :currencies => 'eee' 
     } 
     render json: out 
     end 
    end 
    end 

路由设置精简版这样的:

get '/prefix/*place', to: 'locations#show', as: 'location', defaults: {format:'html'} 

对于某些原因缓存文件夹中的文件以.demo扩展名保存,即使我请求“前缀/某处”

我不明白为什么会发生这种情况。

回答

0

我发现自定义扩展必须与register_alias定义,如果它与另一个演示共享内容类型。

相关问题