-
-
Notifications
You must be signed in to change notification settings - Fork 357
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
ActiveRecord dependency causes rake assets:compile to fail without access to a database #84
Comments
I faced this problem when installing Spree in heroku (Rails 4). This gem doesn't allow to deploy spree in heroku AFAIK. |
Sorry to hear that this is the case. I'd like to look into this. Can you confirm it's still a problem with |
I haven't faced this problem before, and I have has a bunch of apps on Heroku with |
Closing for now. @mattheworiordan, please feel free to contribute further if it's still a problem for you. |
I'm running into the same issue when building a docker container for a solidus app where the database connection is not available when The acts_as_list gem accesses the active record connection in a class method which triggers a database connection: https://github.com/swanandp/acts_as_list/blob/v0.8.0/lib/acts_as_list/active_record/acts/list.rb#L77 quoted_position_column = connection.quote_column_name(configuration[:column]) Looking at the master branch this method is now lazily evaluated, so it might be fixed in the next version: @brendon Could you re-open this issue until a fixed version is released? |
Reading the code on master more carefully, it doesn't seem to be fixed, because those methods are still called inside the class method during |
That's interesting. Are you able to test it out and let me know? Perhaps there's a way to quote without using the method via the connection? |
I switched to master and it seems to work, from reading the code I would have thought that the methods would still be called when the |
Thanks @felixbuenemann, I think that one is only evaluated when the method is actually called. It's certainly difficult to read in its current state. I'll close this since the latest seems to support what you're after. I'll release a new version now too. |
When I include the gem
acts_as_list
in my Gemfile, intentionally change my connection string for PostgreSQL database to an invalid DB, and runrake assets:precompile
, I receive an ActiveRecord error. It appears that acts_as_list tries to connect to the database at all times, even during asset compilation.If you refer to the Heroku post at https://devcenter.heroku.com/articles/rails-asset-pipeline, you will see that this problem unfortunately makes
acts_as_list
incompatible with Heroku.I have worked around the problem by doing something along the lines of:
And I have an initializer which does this:
Here is the error log which unfortunately does not clearly show where the problem lies:
The text was updated successfully, but these errors were encountered: