Skip to content
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

Allow #algolia_dirty? to be defined privately #430

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

magni-
Copy link

@magni- magni- commented Feb 9, 2023

Q A
Bug fix? no
New feature? no
BC breaks? no
Related Issue n/a
Need Doc update no

Describe your change

Include all methods when determining whether an object responds to #algolia_dirty?.

What problem is this fixing?

Object#send can be used to call both public and private methods, but Object#respond_to? only returns true if the argument is a public method. This inconsistency is confusing.

To be more consistent, either #send should be replaced with #public_send, or #respond_to should have its optional include_all argument set to true (in this PR I opted for the latter).

There are many other places in the code that check if a method is defined publicly before calling it via send (checking if callbacks methods like after_commit, etc are defined). I can update those as well if wanted. But #algolia_dirty? seemed like the most critical, since that's the one end users would define themselves (rather than have defined by the framework they're using).

@magni-
Copy link
Author

magni- commented Feb 9, 2023

(CI failures are all caused by Cannot add API key for app ID NOCTT5TZUU: Algolia API error [403] Invalid Application-ID or API key)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant