Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-1972

Module: Mongoid::Relations::Accessors#build confict with Build model

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.0.0
    • Affects Version/s: None
    • Component/s: None

      class Build
        include Mongoid::Document
        has_many :bsuites
      end
      
      class Bsuite
        include Mongoid::Document
        belongs_to :build
      end
      
      bs = Bsuite.new
      bs.build #=> stack level too deep!
      

      resolve:
      rename Module: Mongoid::Relations::Accessors#build to Module: Mongoid::Relations::Accessors#*build , also change getter,setter method to use *build

      because in Module: Mongoid::Relations::Accessors the self is bs, so call build(name, object.substitutable, metadata) will always return nil.

            Assignee:
            Unassigned Unassigned
            Reporter:
            comme comme
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: