Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method `accepts_nested_attributes_for' #224

Open
webdev36 opened this issue Sep 25, 2018 · 2 comments
Open

undefined method `accepts_nested_attributes_for' #224

webdev36 opened this issue Sep 25, 2018 · 2 comments

Comments

@webdev36
Copy link

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`

@Startouf
Copy link

Startouf commented Sep 25, 2018

You most likely forgot to include Mongoid::Document in your model ? Are you using Rails, what's your version ?

@webdev36
Copy link
Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants