immortal icon indicating copy to clipboard operation
immortal copied to clipboard

with_deleted status

Open webdevotion opened this issue 14 years ago • 6 comments
trafficstars

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.

webdevotion avatar Jan 17 '11 15:01 webdevotion

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.

jrom avatar Jan 17 '11 17:01 jrom

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
....

webdevotion avatar Jan 17 '11 17:01 webdevotion

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

webdevotion avatar Jan 17 '11 17:01 webdevotion

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.

jrom avatar Jan 17 '11 18:01 jrom

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"

webdevotion avatar Jan 17 '11 20:01 webdevotion

Yes, just write person and project methods in your Document model that finds using the with_deleted scope.

jrom avatar Jan 17 '11 21:01 jrom