2016-06-21 63 views
2

前段时间我在API模式下启动了Rails 5项目,但现在我想让应用程序也开始呈现html和服务资产。从API模式到非api模式的Rails 5项目

这是我的application.rb貌似现在:

require_relative 'boot' 

require 'rails/all' 

# Require the gems listed in Gemfile, including any gems 
# you've limited to :test, :development, or :production. 
Bundler.require(*Rails.groups) 

module AppName 
    class Application < Rails::Application 
    # Settings in config/environments/* take precedence over those specified here. 
    # Application configuration should go into files in config/initializers 
    # -- all .rb files in that directory are automatically loaded. 
    end 
end 

公告没有提及了的api_mode

然而,当我尝试运行的服务器上,我发现了以下错误:

/home/username/Sites/oneroster/app/controllers/application_controller.rb:8:in `<class:ApplicationController>': undefined method `helper_method' for ApplicationController:Class (NoMethodError) 
    from /home/username/Sites/oneroster/app/controllers/application_controller.rb:1:in `<top (required)>' 

还有什么我应该做的,再次使应用程序的工作?

回答

0

application_controller.rb我有

class ApplicationController < ActionController::API

这不得不改为:

class ApplicationController < ActionController::Base