You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when I use Model.unscoped I have all the objects, deleted and not deleted ones, but if I want to have the same list but from an associated model, I've not been able to find the proper way to do it without monkeypatching the method.
For example, let's suppose: Post has many comments. Comment belongs_to :post. Now, Post.first.comments shows always the scoped list, but how can I get the unscoped list without monkeypatching the comments method in Post model? Yes, comments.unscoped works. But Comment.first.post is always searched with the scoped scope and if the Post have been deleted, the result is nil. How can I include the unscoped ones in this reverse association?
The text was updated successfully, but these errors were encountered:
Hi,
when I use
Model.unscoped
I have all the objects, deleted and not deleted ones, but if I want to have the same list but from an associated model, I've not been able to find the proper way to do it without monkeypatching the method.For example, let's suppose:
Post
has many comments.Comment
belongs_to:post
. Now,Post.first.comments
shows always thescoped
list, but how can I get theunscoped
list without monkeypatching thecomments
method inPost
model? Yes,comments.unscoped
works. ButComment.first.post
is always searched with thescoped
scope and if the Post have been deleted, the result is nil. How can I include theunscoped
ones in this reverse association?The text was updated successfully, but these errors were encountered: