The Question: Is it possible to test within a hashed condition if an attribute of a joined table is greater/lesser than a value

An example: test if actors age is greater than ageVariable:

  • Is it possible to write instead of the ARRAY CONDITION:

    ageVariable = 36<br> Movie.includes(:actors).where("actors.age > ?", ageVariable)
    
  • The HASH CONDITION something like:

    ageVariable = 36
    Movie.includes(:actors).where(:actors => { :age => COMPARE_LOGIC })
    # Where COMPARE_LOGIC is something like: (:age > ageVariable)
    
Edit
Report