A
A
Alexander Petrov2015-10-11 20:45:02
Ruby on Rails
Alexander Petrov, 2015-10-11 20:45:02

How to do a search in Ruby on Rails?

How to make a request with a mask?
Something like @product=Product.where(name: '*Name*')
that is, I set a word in the search and I get all the lines containing this word in the name.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Demidenko, 2015-10-11
@Mirkom63

@products = Product.where("name LIKE ?", "%#{value_for_search}%")

A
Alexey Poimtsev, 2015-10-24
@poimtsev

take a look at sphinx or elasticsearch

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question