Your placeholder is replaced by a string and you’re not handling it right.
Replace
"name LIKE '%?%' OR postal_code LIKE '%?%'", search, search
with
"name LIKE ? OR postal_code LIKE ?", "%#{search}%", "%#{search}%"
More Related Contents:
- ActiveRecord Arel OR condition
- PostgreSQL where all in array
- How to use ANY instead of IN in a WHERE clause?
- PostgreSQL GROUP BY different from MySQL?
- Best way to count rows by arbitrary time intervals
- How to handle Ruby on Rails error: “Please install the postgresql adapter: `gem install activerecord-postgresql-adapter'”
- Perform this hours of operation query in PostgreSQL
- How to round an average to 2 decimal places in PostgreSQL?
- Join multiple tables with active records
- SQL where joined set must contain all values but may contain more
- Find records where join doesn’t exist
- Find all records which have a count of an association greater than zero
- Rails find record with zero has_many records associated [duplicate]
- Prepared Statement on Postgresql in Rails
- Store the day of the week and time?
- ActiveRecord find_each combined with limit and order
- Grouped LIMIT in PostgreSQL: show the first N rows for each group?
- Optimize query with OFFSET on large table
- How to concatenate columns in a Postgres SELECT?
- How to use (install) dblink in PostgreSQL?
- ActiveRecord.find(array_of_ids), preserving order
- PostgreSQL multi INSERT…RETURNING with multiple columns
- Extract date (yyyy/mm/dd) from a timestamp in PostgreSQL
- Oracle equivalent of Postgres’ DISTINCT ON?
- Creating a PostgreSQL sequence to a field (which is not the ID of the record)
- Grant privileges for a particular database in PostgreSQL
- Functions with variable number of input parameters
- Converting an array of objects to ActiveRecord::Relation
- Check if NULL exists in Postgres array
- PGError: ERROR: aggregates not allowed in WHERE clause on a AR query of an object and its has_many objects