How to query with calculations?

Hi,

I would like to do something simple yet I’m confused.
Lets say I have a table with 2 fields: rank, updated_at.
I would like to show all records matching this condition:
rank = rank â?? (Time.now.to_time â?? Updated_at.to_time)
As you can see this is supposed to be a calculation on the field.
How do I write a query to show this?
I’ve tried with_scope, and regular find but did not succeed.
Please advice

Thanks

Adi

hi,
equality on dates does rarely work. it is better to do sometthing like

date1 - 1 sec < date2 && date2 < date1 + 1 sec

I don’t understand either why you need .to_time for Time.now and
update_at