2016-10-07 6 views
3

私はRubyとGemのバージョンが最新でないため、現在はrails testを実行しているときにエラーメッセージが表示されることがあります。以前はrvmとrbenvの両方がインストールされていましたが、私は両方を削除してrvmのみを再インストールしました。このRails Consoleのエラーメッセージに何か問題がありますか?

私はirbに行くとなど、動作しないアクションを呼び出すとき:私は同じコマンド"foo".selectを入力すると、しかし

NoMethodError: private method 'select' called for "foo":String 
    from (irb):4 
    from /Users/Joseph/.rvm/rubies/ruby-2.3.1/bin/irb:11:in '<main>' 

"foo".select、私は簡単なエラーメッセージが表示されます代わりにrails consoleを取得します。

NoMethodError: private method `select' called for "foo":String 
    from (irb):1 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in `start' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:in `start' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:78:in `console' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require' 
    from /Users/Joseph/workspace/sample_app/bin/rails:9:in `<top (required)>' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `block in load' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/spring-1.7.2/lib/spring/commands/rails.rb:6:in `call' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/spring-1.7.2/lib/spring/command_wrapper.rb:38:in `call' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/spring-1.7.2/lib/spring/application.rb:191:in `block in serve' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/spring-1.7.2/lib/spring/application.rb:161:in `fork' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/spring-1.7.2/lib/spring/application.rb:161:in `serve' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/spring-1.7.2/lib/spring/application.rb:125:in `run' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>' 
    from /Users/Joseph/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require' 
    from /Users/Joseph/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require' 
    from -e:1:in `<main>' 

これは正常ですか?それとも私の宝石に何か問題がありますか?

答えて

2

宝石に問題はありません。事は、あなたがirbを実行するとき、それだけです。 Rubyインタラクティブのみを実行します。 rails consoleを実行してコンソールを表示するには、ActiveRecord、rails coreなどで設定する必要があります。これが設定される前にこれがすべてです。

from /Users/Joseph/.rvm/gems/[email protected]_app/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in `start' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:in `start' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:78:in `console' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require' 
    from /Users/Joseph/workspace/sample_app/bin/rails:9:in `<top (required)>' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `block in load' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/spring-1.7.2/lib/spring/commands/rails.rb:6:in `call' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/spring-1.7.2/lib/spring/command_wrapper.rb:38:in `call' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/spring-1.7.2/lib/spring/application.rb:191:in `block in serve' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/spring-1.7.2/lib/spring/application.rb:161:in `fork' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/spring-1.7.2/lib/spring/application.rb:161:in `serve' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/spring-1.7.2/lib/spring/application.rb:125:in `run' 
    from /Users/Joseph/.rvm/gems/[email protected]_app/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>' 
    from /Users/Joseph/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require' 
    from /Users/Joseph/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require' 
    from -e:1:in `<main>' 

などレールコンソールはその時間がかかりながら、IRBは、あなたの初期化子に応じて、本当に速く実行されることに注意してください、構成、

+0

それをクリアしてくれてありがとう! – doctopus

+1

@JosephLiuあなたの質問に答えを受け入れることは決してできません。あなたが質問をするとき、他のユーザーはあなたの問題を解決するために努力します。あなたが最良の答えを選んで(実際にあなたを助けた場合)、それを受け入れなければなりません(答えの近くでチェックマークを探してください)。このようにして、コミュニティにあなたの問題が解決したことを知らせるとともに、あなたを助けたユーザーに報酬を与えます。 –

+0

@AndreyDeineko: – JGutierrezC

関連する問題