[Rails tutorial] Cannot deploy to Heroku/Change from hello, world to hola, mundo

Task

I couldn't solve the first exercise of rails 6.0 version tutorial 1.5.3 well.

Make the same changes as> 1.3.4.1 so that the production app can display "hola, mundo!".

The problem is that after deploying the hello, world! App on Heroku, redeploy the hola, mondo! App. I intended to create a hola, mundo! Heroku action and redeploy it to Heroku, No matter how many times I tried, what was displayed on the browser was not "hola, mundo!" But "hello, world!".

The mistake I was making

The procedure for uploading a file to Git hub was incorrect. Here are the steps I took:

① Create controller. Added hola action.

application_controller.rb


class ApplicationController < ActionController::Base
  def hello
    render html: "hello,world!"
  end
  
  def hola
    render html: "hola,mundo!"
  end
end

② Change the routing. Changed the action from hello to hola.

routes.rb


Rails.application.routes.draw do
 root 'application#hola'
end

③ Create a new application in Heroku. A subdomain dedicated to Rails applications will be created and can be viewed in a browser.

$ heroku create

④ Push to Heroku.

$ git push heroku master

⑤ Enter this command to access the URL that appears.

$ heroku open

that's all.

solution

After step (2) above, the following steps were not enough. The cause was that the file was not uploaded to git hub properly.

① Add the changes to the staging area.

$ git add.

② Add to the local repository.

$ git commit

③ Push to the master branch.

$ git push origin master

↓ Perform steps ③ to ⑤ of "Miss I made".

I was able to solve it.

Recommended Posts

[Rails tutorial] Cannot deploy to Heroku/Change from hello, world to hola, mundo
Rails Tutorial Chapter 1 From Zero to Deployment [Try]
Easy to display hello world with Rails + Docker
Rails Tutorial 4th Edition: Chapter 1 From Zero to Deployment
Chewing Rails Tutorial [Chapter 1 From Zero to Deployment] Second Half
Chewing Rails Tutorial [Chapter 1 From Zero to Deployment] First Half
Rails tutorial When rails new cannot be done due to different versions
How to deploy Bootstrap on Rails
Deploy Rails on Docker to heroku
Rails Tutorial record and memorandum # 1 "From installation to hello_app deployment + error handling"