Patrick
Patrick

Reputation: 1428

What does the "%#{variable}%" syntax mean?

What does the "%#{}%" more specifically the %. I know that "#{variable}" is simply string interpolation, but what about the%`?

I am implementing a simple search form similar to Rails 4 LIKE query - ActiveRecord adds quotes.

Does it have to do with ActiveRecord or the database?

Upvotes: 0

Views: 297

Answers (1)

Hakan Serce
Hakan Serce

Reputation: 11266

% is a wild card for SQL that represent any characters. So if you need to find anything that includes blahblah for instance, you search for %blahblah%.

Upvotes: 3

Related Questions