Pg_Search gem for advance search is parameter is present

trying to do this advance seach using the pg_seach gem 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.

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)