Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails RubyonRails教程卡住了_Ruby On Rails - Fatal编程技术网

Ruby on rails RubyonRails教程卡住了

Ruby on rails RubyonRails教程卡住了,ruby-on-rails,Ruby On Rails,我已经尝试解决这个问题将近3个小时了,但没有成功。当我尝试运行第3章教程中的rails generate-rspec:install时,我得到以下输出: /home/patrick/rails_projects/sample_app/config/application.rb:30:in `': undefined local variable or method `config' for main:Object (NameError) from /home/patrick/.rvm/g

我已经尝试解决这个问题将近3个小时了,但没有成功。当我尝试运行第3章教程中的
rails generate-rspec:install
时,我得到以下输出:

/home/patrick/rails_projects/sample_app/config/application.rb:30:in `': undefined local variable or method `config' for main:Object (NameError) from /home/patrick/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0.rc2/lib/rails/commands.rb:46:in `require' from /home/patrick/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0.rc2/lib/rails/commands.rb:46:in `' from bin/rails:4:in `require' from bin/rails:4:in `' /home/patrick/rails\u projects/sample\u app/config/application.rb:30:in`':未定义的局部变量或main:Object的方法`config'(NameError) from/home/patrick/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0.rc2/lib/rails/commands.rb:46:in'require' from/home/patrick/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0.rc2/lib/rails/commands.rb:46:in`' 从箱子/轨道:4:in“require” 从箱子/轨道:4:in`' Application.rb:

require File.expand_path('../boot', __FILE__)

# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
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(:default, Rails.env)

module SampleApp
  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.

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
    # config.time_zone = 'Central Time (US & Canada)'

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
    # config.i18n.default_locale = :de
  end
end

config.generators do |g|
  g.test_framework  :rspec
end

patrick@X67895:~/rails_projects/sample_app$ gem list

*** LOCAL GEMS ***

actionmailer (4.0.0.rc2, 4.0.0.rc1, 3.2.13)
actionpack (4.0.0.rc2, 4.0.0.rc1, 3.2.13)
activemodel (4.0.0.rc2, 4.0.0.rc1, 3.2.13)
activerecord (4.0.0.rc2, 4.0.0.rc1, 3.2.13)
activerecord-deprecated_finders (1.0.3)
activeresource (3.2.13)
activesupport (4.0.0.rc2, 4.0.0.rc1, 3.2.13)
arel (4.0.0, 3.0.2)
atomic (1.1.9)
builder (3.1.4, 3.0.4)
bundler (1.3.5)
bundler-unload (1.0.1)
capistrano (2.15.4)
coffee-rails (4.0.0, 3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.6.2)
diff-lcs (1.2.4)
erubis (2.7.0)
execjs (1.4.0)
highline (1.6.19)
hike (1.2.3)
i18n (0.6.4, 0.6.1)
jbuilder (1.4.2, 1.0.2)
journey (1.0.4)
jquery-rails (3.0.1, 2.2.1)
json (1.8.0)
mail (2.5.4)
mime-types (1.23)
minitest (4.7.4)
multi_json (1.7.7)
net-scp (1.1.1)
net-sftp (2.1.2)
net-ssh (2.6.7)
net-ssh-gateway (1.2.0)
pg (0.15.1)
polyglot (0.3.3)
rack (1.5.2, 1.4.5)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (4.0.0.rc2, 4.0.0.rc1, 3.2.13)
railties (4.0.0.rc2, 4.0.0.rc1, 3.2.13)
rake (10.0.4)
rdoc (3.12.2)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
rspec-mocks (2.13.1)
rspec-rails (2.13.2)
rubygems-bundler (1.2.0)
rvm (1.11.3.8)
sass (3.2.9)
sass-rails (4.0.0.rc2, 3.2.6)
sdoc (0.3.20)
sprockets (2.10.0, 2.2.2)
sprockets-rails (2.0.0)
sqlite3 (1.3.7)
thor (0.18.1)
thread_safe (0.1.0)
tilt (1.4.1)
treetop (1.4.14)
turbolinks (1.2.0, 1.1.1)
tzinfo (0.3.37)
uglifier (2.1.1)
需要文件。展开路径('../boot',文件)
#选择您想要的框架:
需要“活动记录/轨道连接”
需要“控制器/轨道连接的操作”
要求采取“行动”\u邮递员/railtie
需要“链轮/系杆”
#需要“轨道/测试单元/钢轨接头”
#需要Gemfile中列出的宝石,包括任何宝石
#您仅限于:测试、开发或:生产。
Bundler.require(:default,Rails.env)
模块示例应用程序
类应用程序

我完全不知道下一步该做什么。

在类中移动配置,如下所示:

module SampleApp
  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.

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
    # config.time_zone = 'Central Time (US & Canada)'

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
    # config.i18n.default_locale = :de

    config.generators do |g|
      g.test_framework  :rspec
    end

  end
end
modulesampleapp
类应用程序
发布一些代码,解释您不能做的事情、收到的错误消息等,并请将您的标题编辑为明确的标题,并与您的问题相关。本网站的目的不是为了找到一个人在TeamViewer上为您提供帮助。您在谈论哪些教程?你能添加一个链接吗?