Module: Spud::Search::Searchable::ClassMethods

Defined in:
lib/spud_search/searchable.rb

Instance Method Summary collapse

Instance Method Details

#spud_searchableObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/spud_search/searchable.rb', line 9

def spud_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