您好,我安装了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
其他人也有这个问题吗?
发布于 2014-04-01 16:21:25
请确保安装'pry-nav‘gem。
我也犯了同样的错误,因为我假设导航命令包含在'pry-rails‘gem中。
在Gemfile中添加gem 'pry-nav'
,然后运行bundle install
。
发布于 2016-06-22 18:13:57
您现在可以使用Ruby (用于pry-byebug >= 2.0)或Ruby (用于pry-debugger <= 1.9)。
在Gemfile中将其与pry
gem一起使用:
# Gemfile
gem 'pry'
gem 'pry-byebug'
发布于 2021-12-09 12:59:33
我遇到了类似的问题,在我的例子中,这个问题已经解决了,因为我需要那些gem。例如:
group :development, :test do
...
gem 'pry', require: true
gem 'pry-byebug', require: true
gem 'pry-doc', require: true
gem 'rspec-rails', require: false
...
end
https://stackoverflow.com/questions/20404267
复制相似问题