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 })
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With