Sha256: e42adea0cb1549318661fb57c818d6907ebb28b05aeb50783b691f52235cec54

Contents?: true

Size: 683 Bytes

Versions: 1

Compression:

Stored size: 683 Bytes

Contents

module Spud::Searchable
  extend ActiveSupport::Concern
  included do
    extend ClassMethods
  end
  module ClassMethods
    def spud_searchable
      if self.name == 'SpudPage'
        self.instance_eval do
          acts_as_indexed :fields => [:name, :meta_keywords, :meta_description, :full_content_processed], :if => Proc.new { |page| page.published == true && page.visibility == 0 }
        end
      end
      if self.name == 'SpudPost'
        self.instance_eval do
          acts_as_indexed :fields => [:title, :content_processed, :category_names], :if => Proc.new { |post| post.published_at <= Time.now.utc && post.visible == true }
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tb_search-1.0.1 lib/spud_search/searchable.rb