Sha256: 915a60e6e8e01642712c78fdb4b328a9f8a5049297272a312c9df85854eb0598

Contents?: true

Size: 581 Bytes

Versions: 5

Compression:

Stored size: 581 Bytes

Contents

module Spud::Search::Searchable
	extend ActiveSupport::Concern
	included do
		extend ClassMethods
	end
	module ClassMethods
		def searchable
			if self.name == 'SpudPage'
				self.instance_eval do
					acts_as_indexed :fields => [:name,:meta_keywords,:meta_description], :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], :if => Proc.new { |post| post.published_at <= Time.now.utc && post.visible == true }
				end
			end
		end
	end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spud_search-0.1.5 lib/spud_search/searchable.rb
spud_search-0.1.4 lib/spud_search/searchable.rb
spud_search-0.1.3 lib/spud_search/searchable.rb
spud_search-0.1.2 lib/spud_search/searchable.rb
spud_search-0.1.1 lib/spud_search/searchable.rb