Heroku not reflecting codes pushed to it and differs from Localhost - ruby-on-rails

I have done up a web app with Ruby on Rails and made some changes on my codes in my computer. Thereafter, I did git add ., git commit, git push and git push heroku master.
The Localhost:3000 webpage reflected the codes and showed the change but on heroku, the webpage did not reflect the codes/change.
How do I resolve this?

did you precompile? Otherwise you won't see css changes.
RAILS_ENV=production bundle exec rake assets:precompile
Also see https://devcenter.heroku.com/articles/rails-asset-pipeline

Related

Heroku: removed file in Public folder is still there in production

I added a sitemap.xml file to the Public folder of a Rails application hosted on Heroku. Since then, I removed it and git push heroku master the new version without the file.
However, the file is still there. How can I do to remove it in production?
I tried rake assets:clean and rake assets:precompile without success. I also used the Heroku Repo plugin to heroku repo:purge_cache and heroku repo:reset but the file is still there!
Thanks.

Repush entire site from c9.io to heroku

My c9.io site works very well but my heroku site gives "We're sorry, but something went wrong." after a few clicks. Is there a way to push my entire site to heroku instead of just changes? I'm hoping maybe that will fix it on the heroku side.
Thanks, Jon
Run these commands in the terminal.
git remote -v
git remote rm destination
after removing Heroku, add it again.
heroku create
git push heroku master
heroku run rake db:migrate

'You do not have access to the app' when trying to access heroku console

I recently started collaborating in a project on Heroku using Ruby on Rails. I was added as a collaborator and added the remote to my environment. After some development, I pushed some changes and had no problems:
$ git push staging
Where staging is the name of my remote.
Later, when trying to run "rake test" on Heroku, I recieved an error:
$heroku run rake test --app staging
Running `rake test` attached to terminal... failed
! You do not have access to the app staging.
Which is odd, as I was perfectly able to push my own changes. I checked the Heroku dashboard and saw that my push was logged there. I then tried to view the logs using the console, and the same problem occured.
$ heroku logs --app staging
! You do not have access to the app staging.
Finally, I tried to access the console, but it failed as well.
$ heroku run rails console --app staging
Running `rails console` attached to terminal... failed
! You do not have access to the app staging.
At this point I updated my Heroku toolbelt installation, and used "heroku auth" to verify that my email was showing up, but the error persists. I'm currently contacting Heroku support but I'm hoping someone with a similar issue could aid me in parallel.
Thanks!
So just in case anyone is having a similar problem, this occurs because I was mixing the name of my Heroku Apps with the name of my git remotes. So when I was calling --app staging (the name of my remote), I should have been using the actual name of the app, as found in Heroku.
Be sure to run heroku login before using Heroku toolbelt commands for the first time. It will not tell you that you have not signed in before.
This happen also when you haven't added heroku git remote repository.
You can add it with this command:
git remote add heroku https://git.heroku.com/<your project>.git
You can also type
heroku git:remote -a AppName
I had the same problem because I had created multiple remotes on heroku (e.g. a remote called "staging" for staging, and the default remote "heroku" for prod).
Solution
Use these two options to let heroku know which app and remote you're referring to:
-a your_app_name, and
--remote name_of_remote
Examples
For example, for the remote called staging:
heroku run env -a your_app_name --remote staging
or like this for the production remote:
heroku run env -a your_app_name --remote heroku
Extra Info
The above code runs the simple command env, but you can replace that with whatever commands you want to run on heroku.
Replace the name of the remote. By default, heroku creates one remote called heroku, which is typically the production remote. You can get your remotes with the command: git remote.
This was caused of your ssh key is no more permited to access. Make sure your ssh key is same. You can also regenarate your ssh key and add this to heroku.
You can also run:
heroku run rake test --remote staging
Not sure what happens under the hood, but locally the CLI tool figures out which app you mean based on your git remote.
I had the same problem in my case I was not pushing from master so I had to use this:
git push heroku :main
I had the same problem. It was cause I was not login in Heroku.
First I type:
heroku login
then i type:
heroku git:remote -a restserver-node-jngs
and it works.
I hope it be helpfull for someone.

No "Destroy" confirmation from Browser running Ruby/Rails app on Heroku

Interesting problem... I have created a small Ruby on Rails app that works just fine on localhost:3000 with SQLite but when I put it up on Heroku I loose the ability to destroy records with the scaffolded "Destroy" link for the table.
The behavior that is different is that when I am running on the localHost:3000 I get a browser dialog that looks like this:
When I run on heroku, I don't get the dialog and the "Destroy" doesn't nothing. I am running under Safari and Firefox with the same behavior.
Any thoughts?
Does precompiling the assets help?
In config/environments/production.rb set
config.assets.compile = true
locally run
RAILS_ENV=production bundle exec rake assets:precompile
git add .
git commit -am 'precompiled assets'
git push heroku master

Deploying Heroku app--updating my code?

This is a basic, stupid question, but I configured my Rails app to deploy on Heroku, and I'm able to open the application from my Heroku account, etc. But when I want to change my code, do I need to re-deploy the whole application? I tried just committing/pushing to heroku master, but I get the error "fatal: remote end hung up unexpectedly." What should I do instead?
Also: am I supposed to run db:migrate BEFORE deploying/pushing?
There is nothing stupid about a basic question, as everyone has to start somewhere.
The basic process with deploying a Rails app to Heroku is to:
Make changes
Add and Commit your changes ($ git add files_changed.rb & $ git commit -m "make changes")
Push your changes to Heroku ($ git push heroku master)
This then pushes your code to the remote Heroku repository and redeploys your Rails application. If you have made any database migrations, you need to run:
$ heroku run rake db:migrate
This runs db:migrate on your heroku app - see how that works? :)
Running rake db:migrate locally simply migrates your local development database.

Resources