Nathan Long
Nathan Long

Reputation: 126122

Can I use Ransack to search for the same value in multiple columns?

Can the Ransack gem generate a SQL search of multiple columns for the same value?

For instance, something like "users where the first name OR the last name contains 'James'".

Upvotes: 0

Views: 2296

Answers (1)

NARKOZ
NARKOZ

Reputation: 27961

Yes, here is an example:

MyModel.search(:firstname_or_lastname_cont => "James").result

Upvotes: 9

Related Questions