2017-03-17 84 views
-2

意外結束我不斷收到寫着語法輸入

警告錯誤是我試圖做的rails應用程序教程中的application.rb。

以下是整個文件的代碼。我在最後一個末端出現錯誤。

下面是代碼

require_relative 'boot' 

require "rails" 
# Pick the frameworks you want: 
require "active_model/railtie" 
require "active_job/railtie" 
require "active_record/railtie" 
require "action_controller/railtie" 
require "action_mailer/railtie" 
require "action_view/railtie" 
require "action_cable/engine" 
require "sprockets/railtie" 
# require "rails/test_unit/railtie" 

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

module Listing 
    class Application < Rails::Application 
    config.generators do |g| 
     g.test_framework :rspec, fixtures: true, view_specs: false, helper_specs: false, 
     routing_specs: false, controller_specs: true, request_specs: false 
     g.fixtures_replacement :factory_girl, dir: "spec/factories" 
    end 
end 

如果我拿出所有的類應用和第一端之間的代碼則沒有問題。

有人可以找到問題。我正在使用Cloud 9 IDE。

+0

嘗試結束'tonfig.generators做| G |' –

回答

0

你還沒有結束嗎?更改模塊象下面這樣:

module Listing 
    class Application < Rails::Application 
    config.generators do |g| 
     g.test_framework :rspec, fixtures: true, view_specs: false, helper_specs: false, 
     routing_specs: false, controller_specs: true, request_specs: false 
     g.fixtures_replacement :factory_girl, dir: "spec/factories" 
    end 
    end 
end 
+0

謝謝。這解決了這個問題。 –

0

試試這個:

module Listing 
    class Application < Rails::Application 
     config.generators do |g| 
     g.test_framework :rspec, fixtures: true, view_specs: false,helper_specs:false, 
     routing_specs: false, controller_specs: true, request_specs: false 
     g.fixtures_replacement :factory_girl, dir: "spec/factories" 
     end 
    end 
end