我一直收到错误消息
警告:“结束”时的缩进不匹配,“等级”为20 语法错误意外结束输入期望关键字结束
文件名是我正在尝试的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 :(得分: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
答案 1 :(得分: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