I have a Person model that includes names, and I want to find them as simple as possible.
Is there a rails / ActiveRecord method in the lines of People.like(:name => "%#{query}%") , like DataMapper? I couldn't find anything like this in ActiveRecord docs, but I'm shocked if this is simply not possible.
I am currently running Person.where "name LIKE '%#{query}%'" , which works fine, but is an obvious SQL injection vulnerability.
Rails 3.2
ruby-on-rails activerecord postgresql
AlexQueue
source share