Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'sass' in a non thread-safe way

I'm getting these warnings when trying to use sass in Rails 3.1 rc1.

WARN: tilt autoloading 'sass' in a non thread-safe way; explicit require 'sass' suggested.
WARN: tilt autoloading 'sass/plugin' in a non thread-safe way; explicit require 'sass/plugin' suggested.

This is my Gemfile.

gem "rails", "~> 3.1.0.rc1"
gem "haml"
gem "sass"

I've tried to create a file called sass.rb inside the config/initializers containing this code.

require "sass"

Changing the Gemfile to this.

gem "rails", "~> 3.1.0.rc1"
gem "haml"
gem "sass", require: false

But the warnings remains. Anyone knows how to solve it?

I found the code that is printing the warnings, if that is to any help.

like image 844
Linus Oleander Avatar asked May 23 '11 00:05

Linus Oleander


3 Answers

have you tried doing this in Gemfile?

gem "sass", :require => 'sass'

this is an explicit call, without using initializers. by the way consider that you're using a rc1 release.

like image 86
Andrea Pavoni Avatar answered Nov 01 '22 13:11

Andrea Pavoni


I had the same problem, and was able to solve it by compiling assets locally before pushing to Heroku as mentioned in the article Rails 3.1+ Asset Pipeline on Heroku Cedar

RAILS_ENV=production bundle exec rake assets:precompile

I also tried Itecedors suggestion which also worked:

While precompiling assets, in Rails 3.1.1 and up, you can prevent initializing
your application and connecting to the database by ensuring that the following 
line is in your > config/application.rb:

config.assets.initialize_on_precompile = false
like image 30
htmiguel Avatar answered Nov 01 '22 12:11

htmiguel


On Heroku I was getting this same error and googling did not help me find the problem, so I thought I would add what I found to this questions since it comes up first when searching.

The problem was NOT this error, it was a smaller error while pushing the code up to Heroku. After the gems are listed these lines got me on the path to the answer:

Running: rake assets:precompile
rake aborted!
Tasks: TOP => environment
(See full trace by running task with --trace)
Precompiling assets failed, enabling runtime asset compilation
Injecting rails31_enable_runtime_asset_compilation
Please see this article for troubleshooting help:
http://devcenter.heroku.com/articles/rails31_heroku_cedar#troubleshooting

I had just been configuring Redis on Heroku so I knew that the problem had to be something related to those changes. At that URL I found this:

While precompiling assets, in Rails 3.1.1 and up, you can prevent initializing your application and connecting to the database by ensuring that the following line is in your > config/application.rb:

config.assets.initialize_on_precompile = false

Adding the on_precompile = false line fixed all the errors, including the original one in this question.

like image 44
itecedor Avatar answered Nov 01 '22 13:11

itecedor