Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assets precompilation requires database connection

Issue appears when using virtual attribute validation:

validates :agreement, acceptance: true  

When removing it, assets precompilation no longer requires a database connection.
Any ideas how to save validation and do not precompile assets locally?

like image 399
x3qt Avatar asked Mar 31 '26 17:03

x3qt


1 Answers

You have two options:

Prevent assets being precompiled when initializing your application in config/application.rb

config.assets.initialize_on_precompile = false

or allow them to be initialized and add the heroku labs user-env-compile:

heroku labs:enable user-env-compile -a myapp

Read more:

https://devcenter.heroku.com/articles/rails-asset-pipeline

https://devcenter.heroku.com/articles/labs-user-env-compile

like image 77
John Beynon Avatar answered Apr 03 '26 07:04

John Beynon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!