I'm adding pg_search into a Rails app. I'm not completely understanding the configuration, and would appreciate a gentle nudge in the right direction.
First, I already have a multi model site more or less set up and running on my app. But I want to extend it to also search on associated models.
For example, I have Manufacturer, Car, Model classes. Currently if I search for "Ford", only the manufacturer is returned. I'd also like to return all the associated Cars (which belong to Manufacturer) and Models (which belong to Car).
I can see how to do this as a scoped search
class Car
pg_search_scope :manufactured_by, :associated_against => {
:manufacturer => [:name]
}
end
But if I try to do this on a multisearch it doesn't work
class Car
include PgSearch
multisearchable :against => [:name],
:associated_against => {
:manufacturer => [:name]
}
end
It doesn't generate an error, it simply doesn't pick up the associated records.
I have a feeling I'm missing something fundamental in my understanding of how this all fits together. I'd really appreciate if someone could help me understand this, or point me towards a good source of info. I've been through the info on github and the related Railscast, but I'm still missing something.