SEARCHING w JOIN in one-to-ma,y relationship

I am doing a Search in my ‘properties’ table on column ‘name’ using in
my controller :
conditions = [“name LIKE ?”, “%#{@params[:query]}%”] unless
@params[:query].nil?

this ‘properties’ table has a FK (owner_id) in teh column ‘owner’ to
link it with the table Users…
I can display the owner.name, and I would like also to Search on this
owner.name…

How shoudl I write the :condition with a JOIN to the Users table ?
combining
[“name LIKE ?”, “%#{@params[:query]}%”] unless @params[:query].nil?
WITH
[“owner.name LIKE ?”, “%#{@params[:query]}%”] unless
@params[:query].nil?

thanks for your help

kad

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs