2

我不确定解释这一点的最佳方式,我已经在 Windows 7 上安装了带有 Ruby 1.9.2 的 Rails 3.1beta,创建了一个具有这些路由的新应用程序:

constraints :subdomain => 'admin' do

scope :module => "admin" do

  #resources :undo_items do
    #post 'undo', :on => :member
  #end

  #resources :projects, :domains, :emails, :databases, :admins, :services do
  resources :projects do
  end

  #match "projects" => "projects#index"
  #match "domains" => "domains#index"

  root :to => "projects#index"
end

end

# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
root :to => 'admin/projects#index'

sass 的一个例子是:

div {

        h1 { width: 177px; height: 54px; 
             background: url("summit-logo.png") no-repeat;
             float:left; position: relative; top: 15px; 

             a { text-indent: -9999px; display: block; 
                 width: 100%; height: 100%; }

        }

当请求路由时:

Started GET "/assets/summit-logo.png" FOR 127.0.0.1 at 2011-05-23 09:26:12 +0100

[Sprockets] /summit-logo.png 9a3c3...rest of unique request... fresh

图片位于 app/assets/images/summit-logo.png

关于为什么 Sprockets 似乎找到它但没有显示的任何想法?

谢谢!

4

2 回答 2

2

这是 Sprokes 中的错误

原因是在 Windows Sprockets 中以文本模式读取图像,这会导致各种损坏。在几乎所有情况下,它都会导致发送的字节数少于Content-length标头中声明的字节数。在 Firefox 中,您实际上可以看到页面仍在加载大约 30 秒。那是浏览器等待丢失字节的时间。

看来这很快就会解决:https ://github.com/rails/rails/issues/1207

于 2011-06-05T20:20:51.960 回答
0

我认为您应该在 url(/assets/summit-logo.png) 下查找它,但我认为这很奇怪,您没有得到 404。

就我而言,链轮(或管道中的其他人)以某种方式重新编码了我的图像,因此它们都被扭曲了。好吧,测试版的麻烦...

于 2011-05-25T20:04:41.813 回答