Module: Spud::Searchable::ClassMethods

Defined in:
lib/spud_search/searchable.rb

Instance Method Summary collapse

Instance Method Details

#spud_searchableObject



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

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