Sha256: 366eb6d6e230614d462c1b74c3aaff3da8fe6bf1f65be697ad76832127c961dd

Contents?: true

Size: 547 Bytes

Versions: 39

Compression:

Stored size: 547 Bytes

Contents

module SearchFlip
  module Model
    def self.included(base)
      base.extend(ClassMethods)
    end

    module ClassMethods
      def notifies_index(index)
        if respond_to?(:after_commit)
          after_commit { |record| record.destroyed? ? index.delete(record) : index.import(record) }
        else
          after_save { |record| index.import(record) }
          after_touch { |record| index.import(record) } if respond_to?(:after_touch)
          after_destroy { |record| index.delete(record) }
        end
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
search_flip-3.9.0 lib/search_flip/model.rb
search_flip-4.0.0.beta16 lib/search_flip/model.rb
search_flip-4.0.0.beta15 lib/search_flip/model.rb
search_flip-4.0.0.beta14 lib/search_flip/model.rb
search_flip-3.8.0 lib/search_flip/model.rb
search_flip-4.0.0.beta13 lib/search_flip/model.rb
search_flip-3.7.2 lib/search_flip/model.rb
search_flip-4.0.0.beta12 lib/search_flip/model.rb
search_flip-3.7.1 lib/search_flip/model.rb
search_flip-4.0.0.beta11 lib/search_flip/model.rb
search_flip-3.7.0 lib/search_flip/model.rb
search_flip-4.0.0.beta10 lib/search_flip/model.rb
search_flip-3.6.0 lib/search_flip/model.rb
search_flip-3.5.0 lib/search_flip/model.rb
search_flip-4.0.0.beta9 lib/search_flip/model.rb
search_flip-4.0.0.beta8 lib/search_flip/model.rb
search_flip-3.4.0 lib/search_flip/model.rb
search_flip-3.3.0 lib/search_flip/model.rb
search_flip-4.0.0.beta7 lib/search_flip/model.rb
search_flip-4.0.0.beta6 lib/search_flip/model.rb