mongoid-rspec
mongoid-rspec copied to clipboard
undefined method `accepts_nested_attributes_for'
I'm using mongoid version is 5.1.x with this gem but just got this error in the rspec test.
How can I solve this issue?
undefined method accepts_nested_attributes_for' for Order:Class`
You most likely forgot to include Mongoid::Document in your model ? Are you using Rails, what's your version ?
Hi @Startouf , Thanks for your kind response. I've already added the Mongoid::Document to my model, but just got error when use this method
['Customer', 'Order'].each do |model|
origin_class = Module.const_get("::#{model}", false)
if origin_class
require "ccavenue/ext/#{model.downcase.gsub(/\W/,'_')}_model"
extension = Module.const_get("Ccavenue::Ext::#{model}Model")
origin_class.send(:include, extension)
end
end
occurs error when calling this method origin_class = Module.const_get("::#{model}", false)