Answer the question
In order to leave comments, you need to log in
How to search for a combination of two values in postgresql?
There is a users
table with two columns name and lastname , can I somehow search for records by the totality of the values of these columns? So that you can search by name, by surname and by name and surname at once.
where(name || lastname LIKE ?', "...") - this query searches only by first name or last name.
Answer the question
In order to leave comments, you need to log in
It's good practice to use https://github.com/activerecord-hackery/ransack
This will allow you to write something like this:User.search(name_or_lastname_cont: "имя")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question