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

DocumentNotFound is not storing parameters passed

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

      The Mongoid::Errors::DocumentNotFound error has a attribute reader for params (the parameters used to unsuccessfully find the document(s)) but that attribute is not being set.

      To fix just need to add the @params = params line to document_not_found.rb:23:

       ruby
      if !unmatched && !params.is_a?(Hash)
        raise ArgumentError, 'please also supply the unmatched ids'
      end
      @params = params
      

      It would be nice if it stored the klass in an attribute too so that from the exception I can generate my own error which contains info about the error and generate a 404 page.

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

              Created:
              Updated:
              Resolved: