For heroku, check if necessary table exist before trying to precompile assets

This commit is contained in:
Neil Lalonde 2014-06-12 14:41:37 -04:00
parent efc70a2bca
commit 17f0777d14

View file

@ -48,12 +48,16 @@ end
task 'assets:precompile:css' => 'environment' do
RailsMultisite::ConnectionManagement.each_connection do |db|
# Heroku precompiles assets before db migration, so tables may not exist.
# css will get precompiled during first request instead in that case.
if ActiveRecord::Base.connection.table_exists?(ColorScheme.table_name)
puts "Compiling css for #{db}"
[:desktop, :mobile].each do |target|
puts DiscourseStylesheets.compile(target, force: true)
end
end
end
end
task 'assets:precompile' => 'assets:precompile:before' do
# Run after assets:precompile