Sha256: 89374b94f4f5e3df63bd566d1e34a36edff168f4265bf5fe346e920d86df6a5c
Contents?: true
Size: 782 Bytes
Versions: 4
Compression:
Stored size: 782 Bytes
Contents
require 'activesearch/elastic_search' module ElasticSearchRefresh def save super.tap { Tire.index('_all') { refresh }} end def destroy super.tap { Tire.index('_all') { refresh }} end end class ElasticSearchModel < ActiveMimic include ActiveSearch::ElasticSearch include ElasticSearchRefresh attribute :title attribute :text attribute :junk attribute :special, default: false attribute :tags, type: Array search_by [:title, :text, :tags, store: [:title, :junk]], if: lambda { !self.special } end class AnotherElasticSearchModel < ActiveMimic include ActiveSearch::ElasticSearch include ElasticSearchRefresh attribute :title, type: String search_by [:title, store: [:title, :virtual]] def virtual "virtual" end end
Version data entries
4 entries across 4 versions & 1 rubygems