JackDanger/permanent_records

Rails 3 default_scope and associations

pomartel opened this issue · 1 comments

The example in the Readme won't work with associations. For example, if I put the deleted_at default scope on Product and do this, it will break the association :

@category.products.deleted

This will return all the deleted products, not just the ones for that particular category. It seems to be a known issue : rails/rails#2145

I'm not sure there is anything to do other than remove the default scope and rely on the not_deleted scope. But that increases the likelihood of errors by omission.

I wish I knew a good solution to this but I can't think of anything. As it's been 3 months and nobody else seems to have any ideas either I'm going to close this issue. I agree with you that we should look for a solution, though.