Can't save nil attributes to existing record (only new records).

XMLWordPrintableJSON

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

      I must be doing something wrong. I've tried everything, but nothing I do makes that nil attribute stick. I'm running 2.0.1. I searched the bugs and couldn't find anything like it.

      class Record
        include Mongoid::Document
      end
      
      # This works
      record = Record.new(:attribute_a => nil)
      record.save!
      record.reload.attributes # {:attribute_a => nil}
      
      # This doesn't
      record[:attribute_b] = nil
      record.save!
      record.reload.attributes # {:attribute_a => nil}
      

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

                Created:
                Updated:
                Resolved: