Sha256: 8bce3cba5c8d1f46f32571471adcf76a6032cca5040cfff87fe1e5305c2797e9

Contents?: true

Size: 549 Bytes

Versions: 16

Compression:

Stored size: 549 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

16 entries across 16 versions & 1 rubygems

Version Path
search_flip-2.3.2 lib/search_flip/model.rb
search_flip-2.3.1 lib/search_flip/model.rb
search_flip-2.3.0 lib/search_flip/model.rb
search_flip-2.2.0 lib/search_flip/model.rb
search_flip-2.1.0 lib/search_flip/model.rb
search_flip-2.1.0.beta2 lib/search_flip/model.rb
search_flip-2.1.0.beta1 lib/search_flip/model.rb
search_flip-2.0.0 lib/search_flip/model.rb
search_flip-2.0.0.beta8 lib/search_flip/model.rb
search_flip-2.0.0.beta7 lib/search_flip/model.rb
search_flip-2.0.0.beta6 lib/search_flip/model.rb
search_flip-2.0.0.beta5 lib/search_flip/model.rb
search_flip-2.0.0.beta4 lib/search_flip/model.rb
search_flip-2.0.0.beta3 lib/search_flip/model.rb
search_flip-2.0.0.beta2 lib/search_flip/model.rb
search_flip-2.0.0.beta lib/search_flip/model.rb