You can do it as follows:
Task.where("def = ? or house_id = ?", true, current_user.house_id)
General case:
Model.where("column = ? or other_column = ?", value, other_value)
You can also use Arel:
t = Task.arel_table @tasks = Task.where( t[:def].eq(true). or(t[:house_id].eq(current_user.house_id)) )
source share