我试图更新Rails应用程序。蒙古木有一些问题。对于较旧的版本,它可以正常运行,但是当我更新为最新版本的Mongoid 6.4和Rails 5.2时,它将无法正常工作。
旧版本:
mongoid => 3.1.7
rails => 3.2.22.5
当前版本:
mongoid => 6.4
rails => 5.2.0
我有两个模型:
class Filter
include Mongoid::Document
include Mongoid::Timestamps
has_one :import
end
class Import
include Mongoid::Document
include Mongoid::Timestamps
belongs_to :filter
end
控制台输出:
import.filter.present?
# => true
import.filter.import.present?
# => true
当我尝试从过滤器中获取import_id
时:
import.filter.import_id
# >> NoMethodError: undefined method `import_id' for #<Filter:0x00007fbf326b9308>
Did you mean? import
import=
import?
from /Users/crm27/.rvm/gems/ruby-2.5.1/gems/mongoid-
6.4.0/lib/mongoid/relations/proxy.rb:120:in `method_missing'
有人可以告诉我如何解决吗?