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 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.
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