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)
http://guides.rubyonrails.org/active_record_querying.html#hash-conditions
Only equality, range and subset checking are possible with Hash conditions.
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