Image files in Rails app disappear after subsequent pushes to Heroku -


i seeing odd in rails app, using gem / blog engine called line blog posts. in blog posts, can upload images in line, , images stored in table linespicture.

everything fine locally, , works when push live heroku. in other words, can write 3 blogs pictures in each blog post, images stored in linespicture table, , load normally.

then, if push local branch heroku thereafter, images no longer show in post , error [alt text] comes instead.

checking source of post, still linked internal image file:

<div class="article_content">             <p><p><img src="/uploads/lines/picture/image/5/aac_divisions.png" alt="alt text"/></p> 

i assumed meant image no longer in table, if run heroku run rails console , linespicture.last, image still there:

linespicture.last   linespicture load (1.2ms)  select  "lines_pictures".* "lines_pictures"  order "lines_pictures"."id" desc limit 1 => #<linespicture id: 5, image: "aac_divisions.png", name: "aac divisions", article_id: 1, created_at: "2017-08-19 21:15:42", updated_at: "2017-08-19 21:15:48"> 

so in short, image loading, subsequent pushes causing issue, , yet image file ("aac_divisions.png") still stored in table.

last step, tried running heroku logs didn't see useful. concludes with:

 request_id=5d89a754-429a-46f8-9238-52f1108849ed fwd="98.234.48.100" dyno=web.1 connect=1ms service=20ms status=404 bytes=1829 protocol=https 2017-08-19t21:38:08.487398+00:00 heroku[router]: at=info method=get path="/uploads/lines/picture/image/5/aac_divisions.png" host=quiet-coast-71929.herokuapp.com request_id=a6af52fa-a86d-4008-a924-6e68a307b9af fwd="98.234.48.100" dyno=web.1 connect=0ms service=22ms status=404 bytes=1829 protocol=https 2017-08-19t21:41:52.151184+00:00 heroku[run.8811]: state changed complete 2017-08-19t21:41:52.138358+00:00 heroku[run.8811]: process exited status 0 

any idea why might happen?

in production.rb change

config.assets.compile = false 

to

config.assets.compile = true 

if using rails 4 or earlier version rails, must add gem 'rails_12factor', group: :production gemfile in order heroku serve static assets.

if using rails 5 gem not needed. heroku:

previous versions of rails required add gem project rails_12factor enable static asset serving , logging on heroku. if deploying new application gem not needed. if upgrading existing application can remove gem provided have appropriate configuration in config/environments/production.rb file

finally push heroku again.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -