Last active
December 10, 2015 09:00
-
-
Save jeanbaptistebeck/b82958490382dc6f9dcc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Candidate < ActiveRecord::Base | |
include PgSearch | |
pg_search_scope :search_by_candidate, | |
against: { | |
enterprise: 'A', | |
last_name: 'B', | |
first_name: 'C' | |
}, | |
using: { | |
tsearch: { | |
prefix: true | |
} | |
} | |
end | |
Candidate.create!(enterprise: 'Brand And Celebrities', last_name: 'Bordage', first_name: 'Quentin') | |
results = Candidate.search_by_candiate("Brand") # [Brand And Celebrities] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment