1

Hi have build my own simple profile and am maintaining my code in Heroku, but the images in not get loading Heroku. Here i share my production set-up.

config.serve_static_assets = true
config.assets.compile = false
config.assets.digest = true

I am using ruby 2.3.0 and rails 5.1.

10
  • There is a lot of question with problem like this one, have you tried something? Commented Sep 8, 2017 at 9:13
  • image means profile uploaded by user or static images from asset folder ? Commented Sep 8, 2017 at 9:17
  • Where are the images located - in public or in assets? How are the images included in the views, via its name or do you use the asset pipeline? Did you try to load the images directly by their URLs, did that work? Commented Sep 8, 2017 at 9:17
  • It is static images which is present in assets. Commented Sep 8, 2017 at 9:54
  • I included my images as assets/image.png Commented Sep 8, 2017 at 9:55

1 Answer 1

1

In Rails 5.x apps it is not necessary to require 'rails_12factor' gem because its functions are now included be default: https://github.com/heroku/rails_12factor#rails-5

Just tested and image (/app/assets/images/image.jpg) was loaded correctly with default settings in production configuration:

config.assets.compile = false

config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

if ENV["RAILS_LOG_TO_STDOUT"].present?
    logger           = ActiveSupport::Logger.new(STDOUT)
    logger.formatter = config.log_formatter
    config.logger = ActiveSupport::TaggedLogging.new(logger)
end

and without this options (in any config):

config.serve_static_assets = true
config.assets.digest = true
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Vladv, myoutline.herokuapp.com this is my website URL. You can see now the images is loading but the font awesome icons is not loading.
It is working fine now. I have enabled config.assets.compile = true in production.rb and do precompile in production now it is working fine.

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.