2013-06-18 3 views
-1

저는이 문제를 거의 3 시간 동안은 성공하지 못했습니다.Ruby on Rails 튜토리얼이 붙어

 
/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 `' 

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 

[email protected]:~/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) 

내가 다음에 수행 할 것을 절대적으로 아무 생각이 나는 제 3 장에서 튜토리얼에서 rails generate rspec:install를 실행하려고하면,이 출력을 얻을.

+0

포스트 일부 코드를 당신이 할 수없는 것을 설명, 당신이 무엇을 얻을 오류 메시지, 등, 및 명시 적 하나에 제목을 편집하십시오 귀하의 문제와 관련이 있습니다. 팀 뷰어에서 당신을 도울 사람을 찾는 것이이 사이트의 목적이 아닙니다 – Antoine

+0

일부 코드 – user2495136

+0

어떤 튜토리얼에 대해 이야기하고 있습니까? 링크를 추가 할 수 있습니까? – Mischa

답변

3
지금처럼, 클래스 내부에 설정을 이동

:

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