Sha256: 7629f1cb0062bc7842c1f908773a97611500c2263cf11eed6d80211e5ccd3d67

Contents?: true

Size: 691 Bytes

Versions: 1

Compression:

Stored size: 691 Bytes

Contents

module Spud
  module Search
    module 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], :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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spud_search-0.9.0 lib/spud_search/searchable.rb