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

persisted? should be false in this case ...

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

      hi.
      the persisted? method returns true after a failed insert.

      class SurveyMet

      include Mongoid::Document

      belongs_to :company

      index :company_id, unique: true

      end

      a = SurveyMet.new
      a.company = Company.first
      a.save!
      true

      b = SurveyMet.new
      b.company = Company.first
      b.save!
      => true
      b.persisted?
      => true ----- BUT its not in the DB

      b.safely.save! returns the correct error. E11000 duplicate key error

            Assignee:
            durran Durran Jordan
            Reporter:
            rand99 randy
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              None
              None
              None
              None