Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Michael Sarlitt
Michael Sarlitt
3,140 Points

Treebook page styling is removed after deploying to Heroku

I'm at the "Deploying Treebook to Heroku" step of the "Build a Simple Ruby on Rails Application" course.

I was able to successfully deploy to Heroku after migrating the database, but for some reason my site lost all of it's styling: http://stormy-plateau-4668.herokuapp.com/ (Update: changed it to http://footbook.herokuapp.com, but the problem still occurs)

When I run my app locally, the styling and functionality is intact.

Here are the steps I took to deploy to Heroku:

gem 'devise'
gem 'simple_form', '~> 2.1.0'

group :development, :test do
gem 'sqlite3'
end

group :production do
gem 'pg'
end
  1. git push heroku master (got the sqlite3 error)
  2. Modified the Gemfile to resolve the sqlite3 error (see above)
  3. git add .
  4. git commit
  5. git push heroku master (got the error page because I didn't install the new bundle)
  6. bundle install --without production
  7. git add .
  8. git commit
  9. git push heroku master (got the error page because I didn't migrate the db)
  10. heroku run rake db:migrate

I repeated steps 9 and 10 a few times as a sanity check, but the styling is still gone. Any ideas of how to fix this? It's driving me crazy being that I'm so close to the finish line! Jim Hoskins

1 Answer

This is a common problem with rails compiling assets, please refer to the official heroku documentations on this :

 https://devcenter.heroku.com/articles/rails-asset-pipeline

also make sure your config/application.rb has initialization off :

 config.assets.initialize_on_precompile = false
Michael Sarlitt
Michael Sarlitt
3,140 Points

Thanks, fixed it! For anyone else having this problem, I followed the steps for "compiling assets locally" and then ran a git push heroku master: https://devcenter.heroku.com/articles/rails-asset-pipeline#compiling-assets-locally