0
class Request
include Mongoid::Document
field :code, type: String
validates :code, :presence => true,
:inclusion => { :in => proc { Listing.all_codes } }
使用Mongoid,我試圖驗證:提交表單上輸入代碼,以確保他們使用的是正確的代碼已在數據庫中。列表模型:代碼字段也被命名爲:代碼。的Rails 3:Mongoid validates_inclusion_of錯誤
這是錯誤:
有什麼建議? Mongoid中的參考等價物是什麼?