我gem 'paranoia', '~> 1.0'
在我的rails 3.2.x
应用程序中使用。安装的偏执狂版本是 1.3.3
当我进行递归时,我得到了那个错误:真的我试过了
user.restore! recursive: true
和
User.find(user.id, recursive: true)
我得到同样的错误。
我gem 'paranoia', '~> 1.0'
在我的rails 3.2.x
应用程序中使用。安装的偏执狂版本是 1.3.3
当我进行递归时,我得到了那个错误:真的我试过了
user.restore! recursive: true
和
User.find(user.id, recursive: true)
我得到同样的错误。
它看起来像偏执狂 gem 的错误,已在更高版本中修复。当关联为零时,它会引发此错误。
您可以在此处比较版本之间的相关代码
你的版本:https ://github.com/radar/paranoia/blob/v1.3.3/lib/paranoia.rb#LC89
最新:https ://github.com/radar/paranoia/blob/rails4/lib/paranoia.rb#LC107
基本上他们在最新版本中进行空检查。
destroyed_associations.each do |association|
association_data = send(association.name)
unless association_data.nil? #this condition is missing in your version
您可以对其进行修补或移至最新版本
@RodM 团队已将补丁移到他们的仓库中,但尚未发布。
使用他们的 git repo 作为您的 gem 源,而不是使用 RubyGems。
加入 Gemfile
gem "paranoia", :github => "radar/paranoia", :branch => "rails3"