2
當我打開我的網頁,我收到上述錯誤連同錯誤編譯CSS資產
Started GET "/assets/application.css" for 127.0.0.1 at 2012-03-05 10:07:42 +0530
Error compiling asset application.css:
NoMethodError: undefined method `[]' for nil:NilClass
(in /Users/ritvvijparrikh/Projects/tr/app/assets/stylesheets/tr/sprites.css.scss)
Served asset /application.css - 500 Internal Server Error
我的文件sprites.css.scss沒有改變長時間。但後來我最近升級到Rails 3.2.2
我sprites.css.scss文件
/* Public Area Sprites */
.public_sprites {
background: asset-url('public_area.jpg', image) no-repeat top left;
}
.sprite-aws{ background-position: 0 0; width: 159px; height: 58px; display: inline-block }
.sprite-gr{ background-position: 0 -108px; width: 111px; height: 91px; display: inline-block }
.sprite-hn{ background-position: 0 -249px; width: 111px; height: 91px; display: inline-block }
.sprite-i1{ background-position: 0 -390px; width: 28px; height: 30px; display: inline-block }
.sprite-i2{ background-position: 0 -470px; width: 28px; height: 30px; display: inline-block }
.sprite-i3{ background-position: 0 -550px; width: 28px; height: 28px; display: inline-block }
.sprite-i4{ background-position: 0 -628px; width: 28px; height: 28px; display: inline-block }
.sprite-kb{ background-position: 0 -706px; width: 112px; height: 92px; display: inline-block }
.sprite-nb{ background-position: 0 -848px; width: 111px; height: 91px; display: inline-block }
.sprite-pk{ background-position: 0 -989px; width: 111px; height: 91px; display: inline-block }
.sprite-postmark{ background-position: 0 -1130px; width: 171px; height: 35px; display: inline-block }
.sprite-rd{ background-position: 0 -1215px; width: 111px; height: 91px; display: inline-block }
.sprite-rp{ background-position: 0 -1356px; width: 111px; height: 91px; display: inline-block }
.sprite-sb{ background-position: 0 -1497px; width: 111px; height: 91px; display: inline-block }
.sprite-seal{ background-position: 0 -1638px; width: 119px; height: 45px; display: inline-block }
.sprite-slider1{ background-position: 0 -1733px; width: 500px; height: 320px; display: inline-block }
.sprite-slider2{ background-position: -550px 0; width: 500px; height: 320px; display: inline-block }
.sprite-slider3{ background-position: -550px -370px; width: 500px; height: 320px; display: inline-block }
.sprite-sr{ background-position: -550px -740px; width: 112px; height: 92px; display: inline-block }
.sprite-track_big{ background-position: -550px -882px; width: 415px; height: 304px; display: inline-block }
.sprite-trustlaw{ background-position: -550px -1236px; width: 216px; height: 72px; display: inline-block }
.sprite-unknown{ background-position: -550px -1358px; width: 74px; height: 74px; display: inline-block }
.sprite-vm{ background-position: -550px -1482px; width: 111px; height: 91px; display: inline-block }
/* Contact Sprites */
.contact_sprites {
background: asset-url('contact.png', image) no-repeat top left;
}
.sprite-email{ background-position: 0 0; width: 17px; height: 17px; display: inline-block }
.sprite-facebook{ background-position: 0 -67px; width: 17px; height: 17px; display: inline-block }
.sprite-linkedin{ background-position: 0 -134px; width: 17px; height: 17px; display: inline-block }
.sprite-mobile{ background-position: 0 -201px; width: 17px; height: 17px; display: inline-block }
.sprite-phone1{ background-position: 0 -268px; width: 17px; height: 17px; display: inline-block }
.sprite-phone2{ background-position: 0 -335px; width: 16px; height: 13px; display: inline-block }
.sprite-skype{ background-position: 0 -398px; width: 17px; height: 17px; display: inline-block }
.sprite-twitter{ background-position: 0 -465px; width: 17px; height: 17px; display: inline-block }
.sprite-website{ background-position: 0 -532px; width: 17px; height: 17px; display: inline-block }
.sprite-youtube{ background-position: 0 -599px; width: 17px; height: 17px; display: inline-block }
/* Login Area Sprites */
.login_sprites {
background: asset-url('login_area.png', image) no-repeat top left;
}
.sprite-calendar_39x39{ background-position: 0 0; width: 39px; height: 39px; display: inline-block }
.sprite-deletex{ background-position: 0 -89px; width: 17px; height: 17px; display: inline-block }
.sprite-off{ background-position: 0 -156px; width: 95px; height: 27px; display: inline-block }
.sprite-on{ background-position: 0 -233px; width: 94px; height: 27px; display: inline-block }
.sprite-status_gray{ background-position: 0 -310px; width: 12px; height: 13px; display: inline-block }
.sprite-status_green{ background-position: 0 -373px; width: 12px; height: 13px; display: inline-block }
.sprite-status_red{ background-position: 0 -436px; width: 12px; height: 12px; display: inline-block }
.sprite-status_yellow{ background-position: 0 -498px; width: 12px; height: 13px; display: inline-block }
升級到Rails 3.2.2後,我遇到了類似的問題,但我不確定是因爲這個還是完全不同的。奇怪的是'cap staging deploy'可以工作,但'cap production deploy'不能。 – thekingoftruth 2012-03-20 19:13:20
我在這裏也遇到同樣的問題。我發現註釋掉使用'asset-url'助手修復錯誤的行(但顯然破壞了你的樣式表),所以我認爲它與這個助手如何查找資產文件有關。 – SubmittedDenied 2012-05-10 20:28:28