I have looked heavily into replicating the answer provided here Postgresql: comparing arrays results in "malformed array literal" error However I still receive an error.
I have two tables Locations, and Customers. Locations belongs to customers
addresses = ["1 Mullberry St", "24 Western Ave", "923 Shetland Dr"]
Customer.joins(:location)
.where("'#{addresses}'::text[] && locations.street1")
.pluck(:email)
Below is the SQL and the error that I receive
SELECT "customers"."email"
FROM "customers"
INNER JOIN "locations" ON "locations"."customer_id" = "customers"."id"
WHERE ('{'1 Mullberry St', '24 Western Ave', '923 Shetland
Dr'}'::text[] && locations.street1)
ActiveRecord::StatementInvalid: PG::SyntaxError: ERROR: syntax error at or near "1"