Skip to content

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