persisted? should be false in this case ...

XMLWordPrintableJSON

    • Type: 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 Jordan
            Reporter:
            randy
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: