I have a sql query which I have written in the following way:
SELECT "books".* FROM "books" WHERE (title LIKE '%intro%' OR isbn LIKE '%intro%' or status like '%intro%' or author like '%intro%' or description like '%intro%')
In my rails model I wrote the following way:
def self.search(query)
where(['title LIKE ? OR isbn LIKE ? or status like ? or author like ? or description like ?', "%#{query}%", "%#{query}%","%#{query}%","%#{query}%","%#{query}%"])
end
This works on my sqlite3 database and returns all rows with the query "intro".
However in my postgres database it returns only one row. Could some one suggest me a way.
Contents of my table:
id isbn title description author status
2 15 Introduction to english Introduction to english veena kapoor available
3 16 Introduction to hindi Introduction to hindi rastogi vinayak available
4 17 Introduction to sanskrit Introduction to sanskrit edward solomon available