assets:precompile connects to DB when initialize_on_precompile is false

I have config.assets.initialize_on_precompile = false in my config/application.rb and bundle exec rake assets:precompile still attempts to connect to my DB. I changed my db name in database.yml to a non-existent database so I can tell when it's trying to connect.

$ be rake assets:precompile
rake aborted!
FATAL:  database "aaa" does not exist

Answers


According to Heroku, this config is only available in Rails 3.x. You can also see here in rails/rails repo on Rails 4 that the config for assets isn't there anymore: https://github.com/rails/rails/blob/master/railties/lib/rails/application/configuration.rb

For quick assets compiling, I use a simple sqlite3 config in production. It always connects no matter what. Your database.yml file should not be taken as is from your repo in production anyway. Either you use Heroku or a simple capistrano symlink to your shared folder, or any other custom solution.


Need Your Help

Cancel current/active query in Ruby on Rails

ruby-on-rails ruby postgresql activerecord

In my project I am running a massive query returning lots of data. Due to the size of this query, the runtime sometimes exceeds 1 minute. Ignoring other issues this may create, is there any way to ...

How do I access contents of my database in rails?

ruby-on-rails sqlite rspec

Okay so I have model, and I populated my sqlite database in my seeds.rb here is the code

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.