I’m learning AR and I’m trying to find the best way to search an
ActiveRecord set in order to make a conditional statement decision,
something like .has_value?(value) but for a multi-dimensional array like
an AR set of like 100 rows.
I know I can do something like this:
results = Table.find_by_sql("…")
for result in results
But I’d rather not iterate through every row of results to find out. I
think I read somewhere about being able to use the .find method to
search AR hashes? Something like: results.find(…) but I’m not able to
find more info on that.
I want to be able to have a conditional statement and only have it run
if there is an attribute somewhere in the AR set that matches a given
value. Thanks for any help and suggestions in advance.