Rails 3.1beta Sprockets finds image but image is not displayed?
I am not sure the best way to explain this one, I have installed Rails 3.1beta with Ruby 1.9.2 on Windows 7, created a new app with these routes:
constraints :subdomain => 'admin' do
scope :module => "admin" do
#resources :undo_items do
#post 'undo', :on => :member
#end
#resources :projects, :domains, :emails, :database开发者_如何学Pythons, :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'
One example of the sass is:
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%; }
}
When the route is requested:
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
The image is under app/assets/images/summit-logo.png
Any ideas as to why Sprockets seems to find it but it is not being displayed?
Thanks!
This is a bug in Sprockes
The reason for this is that in Windows Sprockets reads the images in text mode which results in all kinds of corruptions. In almost all cases it results in sending less bytes than declared in the Content-length
header. In Firefox you can actually see that the page is still loading for about 30 seconds. That's the time the browser waits for the missing bytes.
It seems that this will be resolved soon: https://github.com/rails/rails/issues/1207
I think you should look for it under url(/assets/summit-logo.png) but I think it's weird, that you do not get a 404.
In my case sprockets (or somebody else down the pipe) somehow re-encodes my images, so they get all distorted. Well, beta troubles...
精彩评论