jhawthorn/discard

Unable to declare scope :kept as per the readme.md

Closed this issue · 2 comments

The readme recommends overriding scope :kept for dependent relationships.

scope :kept, -> { undiscarded.joins(:post).merge(Post.kept) }

This results in
ArgumentError: You tried to define a scope named "kept" on the model "Comment", but Active Record already defined a class method with the same name.

Thanks for this bug report. I think this is a bug in ActiveRecord, as I don't think ActiveRecord is actually defining a kept scope, but I'll have to look into that.

We're unable to reproduce this. If you could provide a failing test case or other reproduction, I'm happy to look into this.

Did you perhaps include Discard::Model in ActiveRecord::Base? I imagine that could cause this error.