Rails 4 Heroku - changes not getting pushed? - ruby-on-rails

I am using Heroku to try to deploy a personal Ruby on Rails project and everything was going great until today.
I am very very new to Ruby on Rails and Heroku so please bare that in mind. I am not sure what is causing my issue and therefore not sure what code or information is best to supply so please ask me what you think you need to know to help resolve the issue and I will provide it.
My Ruby on Rails app worked fine both locally and on Heroku until I followed the information here to try and serve static images from Amazons S3 bucket. Note I only went as far as the static assets section.
This appeared to stop my Ruby on Rails application from recognising changes in my code. So I would make a change to a HTML file in my editor but the server was serving up the older version of the HTML file, even restarting the server didn't fix this.
I have been searching the web for hours trying to figure out what has gone wrong.
I deleted everything under public assets and I ran the precompile command:
rake assets:precompile
And this seems to have improved things locally, when I edit a HTML file the changes are reflected on localhost. However when I push to Heroku and go to my application hosted on Heroku it still shows the older HTML file no matter how many changes I make and pushes I do to Heroku.
The HTML files that are not updating are located here:
app/assets/templates
I'm not sure what I may have changed that has caused the HTML files not to get updated on Heroku?? What should I look at and try? What other information would be useful in helping track down the issue?

The answer marked as correct in this StackOverflow question worked for me - Updated CSS Stylesheet not loaded following deployment to Heroku? - It looks like I accidently added assets precompiled file in my git repo somewhere along my development and that caused the issue.

Related

Ruby scaffolding link not working

So I believe that I have searched on here and not found any question that pertains to my issue so hopefully someone can guide me. I was required (for a course) to create a Ruby scaffolding "products" page. My page links all worked on the local host rails server but when I tried it on Heroku (also required) all the links work EXCEPT the new product page.
I have exhaustively googled but I must admit that all the computer lingo is new to me so I am unsure what any of it means and of what steps are safe. For the reason that if I make things worse, I will never know what to look for to reverse anything. I have included the error that shows up in Heroku. When I searched that I found many different answers causing me to be unsure which is correct.
If anything else is needed just let me know. Many thanks to any and all that reply!
Error on Heroku
The error says, "relation products" does not exist.
Did you make sure to run heroku run rake db:migrate ? After you migrate you'll need to heroku restart
This gets me a lot as part of my Heroku deployments, so I make sure to write a script or rake task which does the git push to deploy to Heroku, then runs these two commands. Then I always use that script to deploy, instead of manually doing a push.

Blank Page Hosting Wordpress in Heroku

I've followed Ry Walker's instructions in Setting up a Wordpress blog on Heroku as a subdirectory of a Rails app also hosted on Heroku.
Everything seemed to work fine at first (I was able to access the Wordpress app through the /blog subdirectory), however after a few minutes I started getting a blank page as result of both /blog and [blog-app].herokuapp.com
I have gone through the steps twice and the same problem persists. Unfortunately, Heroku logs does not show any errors. I am afraid that this is related to the RewriteBase directive.
Has anyone faced similar problem?
I was having a similar problem, and it ended up being related to a bug in the rack-reverse-proxy gem where the content length header was getting corrupted.
There have been two people that have offered up fixes to the gem, but the fixes haven't been merged into the master branch. I forked the branch, copied the fix somebody had suggested, and used my version of the gem in the Gemfile. It's been working great ever since.
Here's the change you'll need to make in lib/rack/reverse-proxy.rb
# ensure content length header is correct
res.content_length = body.bytesize

Newly uploaded images break in production but not in development

I would appreciate any feedback regarding what may be causing my issue, described below.
I have an application that allows users to upload images. Everything works fine in development and used to work fine in production.
Recently, my newer images have all broken. I can upload new images, but when I check back a few hours later, the images are broken again. This started happening about a week ago, and images that I've had up in production from before then are still ok.
I am using Rails with Bootstrap and SimpleForm, and using Paperclip for the images. I am using Postgres in both devleopment and production, and am deploying to Heroku.
The only hint I have is in the "blank_profile_pic.png" image that I use as a default when users don't have a profile picture uploaded.
User.all.each do |u|
if u.profile_pic.file?
image_tag(user.profile_pic)
else
image_tag("blank_profile_pic.png")
end
end
For users that don't have a profile_pic uploaded, a broken image appears if their profile was created in the last week, but the expected "blank_profile_pic.png" remains for people that created their account before the issues started surfacing a week ago. How can the same block of code return different results between recent and older users?
I really don't know where to start with this, so would appreciate any feedback regarding what possible causes could be, and if there are any other files that I can show here.
Thanks very much for your help!
Heroku is a read only system. So you most definitely have to upload your images either to S3 or some other cloud provided.
Your images might have been uploaded to /tmp in Heroku and then somehow it was cleared, hence the errors.
Here are the docs: https://devcenter.heroku.com/articles/read-only-filesystem
And configuring Paperclip with S3: https://github.com/thoughtbot/paperclip#storage
I am not sure if you have the imagemagick gem installed, but we had same issue with image_magic that was breaking our paperclip functionality in production, but not in development (weird, I know). Yet even after removing imagemagick from our gemfile and Gemfile.lock locally (running bundle install and all that stuff) and then deploying back to production on heroku, the error persisted in production! (weird, I know).
What ended up doing the trick was running:
$ heroku repo:purge_cache -a myAppName
(Taken from: https://github.com/heroku/heroku-repo#purge_cache)
When you deploy your app, Heroku caches some things like your assets and installed gems in order to speed up deployment. Although this is a great feature, it can have side-effects sometimes, and in this case, it seems that something about the imagemagick gem got "stuck" in production's cache, which is why purging solved the issue for us (since after purging, your app will rebuild itself from scratch on your next deployment)

Ruby on Rails. How do I change view file in production without restarting server

I made feature that allows to change one of view files through browser.
It changes file and doesn't use DB. In development mode all works well.
But as far as I know rails caches all files in production mode.
Does somebody know solution?
I have found this post
http://railshints.tumblr.com/post/1559660060/reload-rails-templates-dynamically-in-production-mode but it seems not work or I do something wrong.
I use Rails 2.3.5

Asset pipeline broken after pushing to heroku - rails 3?

I don't know what happened differently this time - my local env is running great. And my heroku app was running great. I pushed some code, and now it seems as if the asset pipline broke in my heroku app?
/assets/all.css and /assets/application.js both product "not found" errors now.
Any ideas what could have caused this or how I might be able to fix it?
To be clear - my app was working great yesterday. I didnt change the config in regards to the asset pipeline.
As ream88 said, you need the cedar stack to use Asset Pipeline. You need to create a new heroku project with --stack cedar option and modify your gemfile a bit.
I have a blog post on the subject. You can skip the compass/bootstrap stuff if you don't need it.
For future reference this was apparently a hardware failure for the day at heroku which they notified me of the following day, via email.

Resources