pg_search_scope :keyword_search, :against=>Space.columns.select {|column| [:string, :text].include? column.type }.map(&:name),:associated_against => {·:property => [ {:submarket => [:name]}, :street_address, :city, :state, :zip_code, :country, :building_class]}
PGError: ERROR: column properties.{:submarket=>[:name]} does not existLINE 1: ..."spaces"."id" AS id, array_to_string(my_array_agg("propertie...
I have some ideas about making this possible without multisearch, but they are still on the drawing board.
Grant
I believe that you can accomplish what you want by merging scopes together.
Account.joins(:customer).merge(Customer.search_address("123 Easy St"))
You might even be able to do this:
Account.joins(:customer => :address).merge(Address.search_address("123 Easy St"))
Let me know if it works for you. I just thought of it and it seems more powerful than :associated_against
Thanks!
Grant
@accounts.joins(:customer).merge(@distributor.customers.search('street'))
Where @accounts was an ActiveRecord Relation, threw an error:
PGError: ERROR: table name "accounts" specified more than once
Have it working like so at the moment:
customers = @distributor.customers.search(params[:query])
@accounts = @accounts.where(:customer_id => customers.map(&:id))
So will keep it that way for now. Thanks for trying to help.