rails/PostgreSQL query which contains the search string

150 views Asked by At

I am using ror framework to generate a rest api with PostgreSQl as a database. I have a table with the following structure: orders id: uuid code: int8

Rows: 1 1000000045

So, the above row should be selected when the user types in either 45 or 4. How can I do that ? The ror code that I am trying with is as below:

scope :by_code_number, lambda { |code_number|
    where(code_number: code_number)
}

How can we achieve this using ror with postgresql. Is this possible with int8 datatype for the column or is only possible with String datatype.

Thanks

0

There are 0 answers