0

I have some constants defined in my Rails app that I want to use in my JS files.

To do this, I have js.erb files in my assets/javascripts directory, and insert those constants where needed in ERB blocks.

However, Heroku apparently doesn't load the app before precompiling the assets, so that approach isn't working.

How can I include my Ruby constants in my JS files?

1 Answer 1

2

Have you tried compiling your assets locally before pushing to Heroku?

They have some docs on it here actually: https://devcenter.heroku.com/articles/rails-asset-pipeline#compiling-assets-locally

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.