immortal
immortal copied to clipboard
with_deleted status
Just curious about the status of with_deleted feature? Using the gem in a project going from Rails 2.x to Rails 3.x. Incompatiblity of with_deleted is a showstopper for us atm.
Can you please explain with more detail the issue? There's a with_deleted scope implemented, and also count_with_deleted and find_with_deleted methods to provide backwards compatibility.
I'm getting Unknown key(s): with_deleted
snippet from my model class Document < ActiveRecord::Base include Immortal
# this used to work with acts_as_paranoid
belongs_to :person, :with_deleted => true
belongs_to :project, :with_deleted => true
....
activesupport (3.0.3) lib/active_support/core_ext/hash/keys.rb:43:in `assert_valid_keys'
activerecord (3.0.3) lib/active_record/associations.rb:1772:in `create_belongs_to_reflection'
activerecord (3.0.3) lib/active_record/associations.rb:1220:in `belongs_to'
activerecord (3.0.3) lib/active_record/autosave_association.rb:137:in `belongs_to'
app/models/document.rb:6
Ok! Now I got you, :with_deleted in the association. This is not implemented, we discussed about this feature and decided that's better to have it explicitly called wherever you need that. If you really think this is necessary and would use it, feel free to contribute it.
I would, if I would know where to start :) Could you tell me what the alternative route would be in my case? cfr. "to have it explicitly called wherever you need that"
Yes, just write person and project methods in your Document model that finds using the with_deleted scope.