0

I am trying to deploy a rails project into heroku using travis. Build is successful and tests are also passing. Deployment is also successful. but when I test the heroku app, I find that image files in my app/assets/images directory are not getting displayed in the deployed application.

Here is my .travis.yml file.

language: ruby
rvm:
  - 2.2.3
gemfile:
- gemfiles/Gemfile.rails-4.2.5
env:
  - DB=sqlite
script:
 - RAILS_ENV=test bundle exec rake db:migrate --trace
 - bundle exec rake db:test:prepare
 - RAILS_ENV=test bundle exec rspec -f d

install:
  - bundle install

deploy:
  provider: heroku
  skip_cleanup: true
  app: <my app name>
  api_key:
    secure: <proper key> 
  on: 
   gemfile: gemfiles/Gemfile.rails-4.2.5
  strategy: git
  run:
    - "rake db:migrate"

Can somebody help me understand why image files are missing. I can see them in my github application folder. but they are not getting deployed properly by travis to heroku.

thanks

Sharvari Nagesh
  • 293
  • 3
  • 17

1 Answers1

0

I see you are usign Rails 4, are you sure to be setting serve_static_assets = true in production.rb? Refer to Rails 4 images not loading on heroku.

Also, make sure to precompile your assets as you deploy from Travis CI. So add under deploy: run:

    deploy:
      ...
      run:
        - "rake db:migrate"
        - "RAILS_ENV=production bundle exec rake assets:precompile"
Community
  • 1
  • 1
Olalekan Sogunle
  • 2,299
  • 1
  • 20
  • 26