Pg_Search gem for advance search is parameter is present

trying to do this advance seach using the pg_seach gem
pg_searchhttps://github.com/Casecommons/pg_search

There is my advance_search

pg_search_scope :advance_search, using: { tsearch: { dictionary:
“spanish”} },
associated_against: {summary: [:summary_description, :specialties],
experience: [:description, :job_title], study: [:study_title], course:
[:title], language: [:language]}

this is the method

def self.advsearch(summary_description, specialties, place, study,
course, language)
end

As you can imagine the parameters could be present all of them, none of
them or some of them

so incide my method I would like to do somehting like :summary =>
summary_description.present? or something like that, also is the
parameter
is not present the pg_search doesn’t need the joing. I don’t find
anything
similar in the help. So I need the help of all of you

Thanks in advance.

On Tue, Jan 15, 2013 at 5:20 PM, Jean [email protected] wrote:

def self.advsearch(summary_description, specialties, place, study, course,
language)

end

As you can imagine the parameters could be present all of them, none of them
or some of them

I would advise you make each of them a single-item scope, and then
chain them together in this one. That will be the most modular and
flexible. On each one, you can test for whether the desired item is
present or not, before invoking the pg_search scope. See

for more information

-Dave (who wrote that slide deck)


Dave A., the T. Rex of Codosaurus LLC,
secret-cleared freelance software developer
taking contracts in or near NoVa or remote.
See information at http://www.Codosaur.us/.