44

こんにちは、素晴らしいデバッグを行うために Pry をインストールし、以前は動作していましたが、'next' でコードにステップ インすると、次のエラーが発生します。

SyntaxError: (eval):2: Can't escape from eval with next

使用されているコード:

def create
    binding.pry
    build_resource(sign_up_params)

    if resource.save
      yield resource if block_given?
      if resource.active_for_authentication?
        set_flash_message :notice, :signed_up if is_flashing_format?
        sign_up(resource_name, resource)
        respond_with resource, :location => after_sign_up_path_for(resource)
      else
        set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_flashing_format?
        expire_data_after_sign_in!
        respond_with resource, :location => after_inactive_sign_up_path_for(resource)
      end
    else
      clean_up_passwords resource
      respond_with resource
    end
  end

他の誰かがこの問題を抱えていますか?

4

4 に答える 4

64

「pry-nav」ジェムを必ずインストールしてください。

ナビゲーション コマンドが「pry-rails」gem に含まれていると仮定したため、同じエラーが発生しました。

gem 'pry-nav'Gemfileを追加してから、 を実行しbundle installます。

于 2014-04-01T16:21:25.430 に答える
25

pry-byebug gem (Ruby >= 2.0 の場合) またはpry -debugger gem (Ruby <= 1.9 の場合)を使用できるようになりました。

Gemfileで gem と一緒に使用pryします。

# Gemfile
gem 'pry'
gem 'pry-byebug'
于 2016-06-22T18:13:56.697 に答える
1

同様の問題がありました。私の場合、これらの宝石を必要とする必要があったため、問題は解決しました。例えば:

group :development, :test do
  ...
  gem 'pry',                                require: true
  gem 'pry-byebug',                         require: true
  gem 'pry-doc',                            require: true
  gem 'rspec-rails',                        require: false
  ...
end
于 2021-12-09T20:59:33.327 に答える