Sha256: 578ba51e6df5d50971c34768d14719618a299940784d7f4c990b086b274561a8
Contents?: true
Size: 724 Bytes
Versions: 6
Compression:
Stored size: 724 Bytes
Contents
require "active_support/concern" require "active_support/core_ext/class/attribute" module PgSearch module Multisearchable extend ActiveSupport::Concern included do has_one :pg_search_document, :as => :searchable, :class_name => "PgSearch::Document", :dependent => :delete after_create :create_pg_search_document, :if => lambda { PgSearch.multisearch_enabled? } after_update :update_pg_search_document, :if => lambda { PgSearch.multisearch_enabled? } end module InstanceMethods def update_pg_search_document create_pg_search_document unless self.pg_search_document self.pg_search_document.save end end end end
Version data entries
6 entries across 6 versions & 1 rubygems