1.讓生產(chǎn)環(huán)境中的應(yīng)用顯示“hola, mundo!”
- (1)在 ApplicationController 中添加 hello 動(dòng)作
#app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
def hello
render html: "hola, mundo!"
end
end```
- (2) 設(shè)置根路由
config/routes.rb
Rails.application.routes.draw do
root 'application#hello'
end```
- (3)提交
git commit -a -m "hello"
- (4)推送
git push
- (5)使用 Git 把主分支推送到 Heroku 中
$ git push heroku master
- (6)
heroku open
查看