Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3.1.0 assets folder not rendering: Sprockets::Environment#static_root is deprecated

When trying to update my rails 3.1.0.rc4 app to rc6, I must have messed something up because my assets (JS and CSS files) stopped rendering. I tried to revert to rc4, but was still having this problem. So I transferred all my files over to a new 3.1.0.rc6 app and everything appears to work fine, but I get the following messages:

Sprockets::Environment#static_root is deprecated

Sprockets::Environment#path is deprecated

followed by a long list of files - I can attach the extended msg if needed. I'm guessing I inadvertently fooled around with the sprockets configuration and that's what's been messing up my app from the beginning. How do I de-deprecate/re-?configure sprockets I guess is my question?

I've tried some different sprockets gem versions, but nothing has worked yet.

Thanks.

like image 492
Matt Ruzicka Avatar asked Aug 20 '11 05:08

Matt Ruzicka


2 Answers

Check this for the deprecation warnings https://github.com/rails/rails/issues/2598

So these warning will be removed and don't affect functioning of your app.

like image 77
Nico Avatar answered Oct 17 '22 21:10

Nico


As everyone said, this is a harmless deprecation error. Like some, I perhaps irrationally find the messages in my logs and test sessions irritating. This github issue suggests a quick and effective work around:

https://github.com/sstephenson/sprockets/issues/161

Sprockets 2.0.0.beta.14 is the culprit and putting this in your gem file clears the errors:

gem 'sprockets', '2.0.0.beta.13' 

Just don't forget to check back for an official release or follow the original issue linked to by Nico for news of the real fix. Then you can free this version specific dependency and upgrade without these messages.

like image 38
Charles Forcey Avatar answered Oct 17 '22 22:10

Charles Forcey