-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On Rails 4, causes rake assets:precompile incorrectly to attempt to initialize DB connection #396
Comments
There's a workaround, working for me until recently:
But that's no help if you're using something like activeadmin, which does the invocation without having the ability to control it like that. |
I can confirm this issue. Any word on a fix or workaround would be much appreciated. Thanks! |
|
@trappist Thanks for the fast response. I did see Heroku's documentation surrounding user-env-compile -- and enabling it does address the issue -- though I'm a bit wary of relying on this workaround as Heroku cites it as counter to best practices. |
I understand why they say that, but all it really does is force your Heroku instance to behave more like your local development instance, which does load your environment for tasks like assets:precompile. Heroku doesn't, probably because it saves time and (you're right) shouldn't be necessary. So, it's not a fix, but it's a very good workaround. |
Actually, no. I encountered that early on in debugging this. It did not work for me -- I suspect it wouldn't for @mdb either, unless he also had the
(again, unless you have the The "RAILS_ENV=production" is relevant and has a great deal of impact. Of course, whatever you have setup in database.yml for production is very unlikely to work from the Heroku servers. Once again: In Rails 4, the Rake task assets:precompile IS NOT SUPPOSED TO LOAD YOUR ENVIRONMENT, EVEN LOCALLY. The fact that it does so when using acts_as_taggable_on is definitely a BUG within acts_as_taggable_on. Something within the gem libraries is trying to initialize the application stack, when it shouldn't. The reason this is a compatibility bug is because the |
+1 |
Is there a temporary fix for this?? |
Point your gem to the repo/branch for #403 and it should deploy just fine. |
Didn't seem to work... Using: https://github.com/shekibobo/acts-as-taggable-on |
|
Worked, thank you! |
No problem. |
Check to see if we can connect to the db before accessing it. Fixes #396.
Check to see if we can connect to the db before accessing it. Fixes mbleigh#396.
When using acts_as_taggable_on, rake assets:precompile will fail if there is no production database, because it tries to initialize the app, which it should not do (in rails 4 there is no longer a config.assets.initialize_on_precompile option):
This is a big problem because currently pre-compiliing assets is the only reliable way to get them to work on Heroku.
The text was updated successfully, but these errors were encountered: