-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix clear cache for delete db #216
Conversation
I work with @MarkFull On further investigation we found that the couchrest_model way of monkeypatching |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like recreate!
calls delete!
so this change shouldnt be needed. From some debugging looks like the new version of delete!
here doesnt seem to take hold.
|
As `include` won't override the original method, reopen the class and `alias_method` did the job. Thanks to help from @ktaragorn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This version of the changes were tested to work with recreate!
as well.
@MarkFull @kanterov thanks for looking at this! There are a couple of points however. It would be great to have a test demonstrating that this is not currently working as expected, and secondly, given that we no longer support Ruby < 2.0, we can safely use the |
Confirmed and fixed in this commit: 38bce62 Thanks! |
The current way of clearing cache when deleting db does not work well.
The reason is include does not override the
delete!
method.In this way this PR is fixing the problem: reopen the class,
alias_method
delete!
to another name, clear cache in the redefined method, to achieve the overridden effect.