serializable_hash(only: []) should exclude all fields

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Unknown
    • 10.0.0, 9.1.0
    • Affects Version/s: 9.0.8, 8.1.12
    • Component/s: None
    • None
    • None
    • Ruby Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      When serializable_hash is called with only: [], it results in all fields being included, rather than excluding everything. This behavior has been in place since 2012, but it is confusing.

      Brad Pardee has created a PR to address this here: https://github.com/mongodb/mongoid/pull/6031

      Because this behavior has been in place for so long, we prefer to move carefully here and assume that changing the behavior may potentially break some existing applications. Thus, we should introduce a feature flag (default false) that enables the new behavior, change the default to true in the next major version (Mongoid 10), and finally remove the flag in the next major version after that (e.g. Mongoid 11).

              Assignee:
              Unassigned
              Reporter:
              Jamis Buck
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: