Ruby on rails:在Heroku制作中不允许使用基本的hello world返回方法

问题描述:

我在rails中真的很新,我现在在做Cloud9的rails教程。Ruby on rails:在Heroku制作中不允许使用基本的hello world返回方法

我做了一个简单的终端来测试我可爱的Hello World在默认ApplicationController。这是我的控制器:

的ApplicationController

class ApplicationController < ActionController::Base 
    protect_from_forgery with: :exception 
    def hello 
    render html: "hello, world" 
    end 
end 

这工作完全正常: Hello world

但是当我部署在Heroku的项目,它返回method not allowed.

Method not allowed

任何想法我做错了什么? 这是其他重要文件,我有

的Gemfile

source 'https://rubygems.org' 

gem 'rails',  '5.1.2' 
gem 'puma',   '3.9.1' 
gem 'sass-rails', '5.0.6' 
gem 'uglifier',  '3.2.0' 
gem 'coffee-rails', '4.2.2' 
gem 'jquery-rails', '4.3.1' 
gem 'turbolinks', '5.0.1' 
gem 'jbuilder',  '2.7.0' 

group :development, :test do 
    gem 'sqlite3',  '1.3.13' 
    gem 'byebug', '9.0.6', platform: :mri 
end 

group :development do 
    gem 'web-console',   '3.5.1' 
    gem 'listen',    '3.0.8' 
    gem 'spring',    '2.0.2' 
    gem 'spring-watcher-listen', '2.0.1' 
end 

group :production do 
    gem 'pg', '0.20.0' 
end 

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 

路线

Rails.application.routes.draw do 
    # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html 
    root 'application#hello' 
end 

而且之前我推到Heroku的我做

> bundle update 
> bundle install --without production 
+0

你可以得到堆栈跟踪并添加它吗? – kiddorails

+0

你是在Heroku上运行你的bundle命令还是在本地运行? –

+0

另外,用'rails s -e production'在本地运行你的.appliation,看看它是否给出同样的错误 – kiddorails

好感谢最多Pleaner我意识到我试图连接到一个错误的URL ...我知道,不是很c杠杆。问题是,当我推到Heroku的对它说:

remote: Verifying deploy.... done. To https://git.heroku.com/vast-cove-65343.git

但好,正确的网址是 https://rails-tutorial-hello-mauri.herokuapp.com/

我得到这个从我的Heroku帐户,单击打开应用选项。

谢谢最大