Reputation: 2814
LIKE query in mysql, queries the database and disregards case. For example:
"bzupnick" = "Bzupnick" # false
"bzupnick" LIKE "Bzupnick" # true
So how does one do a LIKE query in Ruby on Rails.
Here's an example query:
@results = User.joins(:jobs).where(:jobs => { :job_name => job }, :users => { :zip => zip })
Upvotes: 5
Views: 14867
Reputation: 1570
try this..
User.joins(:job).where("job_name like ? and name like ?","%Dummy%", "%Bzupnick")
You can also verfify the SQL query by putting to_sql at the end of the above statement
Upvotes: 10