下次使用Pry-rails时无法逃脱eval

时间:2013-12-05 15:42:07

标签: ruby-on-rails pry pry-rails

您好我已经安装了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

还有其他人有这个问题吗?

3 个答案:

答案 0 :(得分:48)

请确保安装' pry-nav'宝石。

我有同样的错误,因为我假设导航命令包含在' pry-rails'宝石。

在您的Gemfile中添加gem 'pry-nav',然后运行bundle install

答案 1 :(得分:11)

现在可以使用pry-byebug gem(对于Ruby> = 2.0)或pry-debugger gem(对于Ruby< = 1.9)。

在Gemfile中与pry gem一起使用:

# Gemfile
gem 'pry'
gem 'pry-byebug'

答案 2 :(得分:-2)

我认为这里的问题是你在一个区块内进行调试,所以当你在里面时,你不能打电话给next