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

`to_param` returns nil on deleted models

    • Type: Icon: Task Task
    • Resolution: Done
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      As the title says, deleted models returns nil on calling to_param.

      I'm using Mongoid::Paranoia to implement a simple trash mechanism in my web app, and the whole trash site can't be displayed because the generation of urls fails. I know, it's standard in ActiveModel, but together with Mongoid::Paranoia it makes no sense at all to return nil calling to_param on deleted models.

      class Model
        include Mongoid::Document
        include Mongoid::Paranoia
      end
      
      model = Model.create
      model.destroy
      
      model.to_param
        # => nil
      

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

              Created:
              Updated:
              Resolved: