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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/algoliasearch-rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ def algolia_index_name(options = nil)

def algolia_must_reindex?(object)
# use +algolia_dirty?+ method if implemented
return object.send(:algolia_dirty?) if (object.respond_to?(:algolia_dirty?))
return object.send(:algolia_dirty?) if (object.respond_to?(:algolia_dirty?, true))
# Loop over each index to see if a attribute used in records has changed
algolia_configurations.each do |options, settings|
next if algolia_indexing_disabled?(options)
Expand Down
2 changes: 2 additions & 0 deletions spec/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,8 @@ class Ebook < ActiveRecord::Base
searchableAttributes ['name']
end

private

def algolia_dirty?
return true if self.published_at.nil? || self.current_time.nil?
# Consider dirty if published date is in the past
Expand Down