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

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

    • Type: Icon: Task Task
    • Resolution: Done
    • 2.4.0
    • Affects Version/s: None
    • Component/s: 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 Unassigned
            Reporter:
            edlebert edlebert
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: