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

Merge options given to #store_in so that previous settings are not lost

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

      Currently, the result of the following...

      class Band
      include Mongoid::Document
      store_in collection: "one"
      store_in session: "two"
      end

      ...will result in {{Band.storage_options ==

      { session: "two" }

      }}, losing the earlier configuration. This is a contrived example. In my case, I was including modules into the class which themselves made calls to #store_in; this made the issue much more difficult to track down.

      I think the current functionality is not the expected result. This pull request merges configurations together, instead of replacing them entirely, so that the above example would produce {{Band.storage_options ==

      { collection: "one", session: "two" }

      }}. Later calls to #store_in still take precedence over earlier ones.

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

              Created:
              Updated:
              Resolved: