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

dup / clone extra queries

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 5.0.1
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      Hello,

      class Price
      include Mongoid::Document
      belongs_to :currency
      end

      c = Currency.first
      p = Price.new :currency => c

      is there any reason why

      copy = c.dup

      generates a query to get the currency? {{p}}already has the currency, why not just pass it to copy and save an extra query?

            Assignee:
            dianna.hohensee@mongodb.com Dianna Hohensee (Inactive)
            Reporter:
            muichkine Olivier Milla
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: