Skip to content

Instantly share code, notes, and snippets.

@durran
Created November 1, 2010 18:31
Show Gist options
  • Save durran/658652 to your computer and use it in GitHub Desktop.
Save durran/658652 to your computer and use it in GitHub Desktop.
class Message < ActiveRecord::Base
include Postgre::Searchable
has_many :tags, inverse_of: :message
search_on do |message|
[ message.subject,
message.body,
message.tags.map(&:name) ]
end
end
Message.search("red green blue")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment