Method in search

How do I use a method in a search? I have a field/column called
‘time_zone’. There I store timezone names, e.g. ‘Stockholm’. What if I
want to transform that value into hour like
Time.now.in_time_zone(time_zone).hour and search for that? Something
similar to:

@reminder = Reminder.find(:all, :conditions => [“reminder=? AND
#{Time.now.in_time_zone(time_zone_column).hour}=?”,‘daily’,8])

Paul B. wrote in post #1008265:

How do I use a method in a search? I have a field/column called
‘time_zone’. There I store timezone names, e.g. ‘Stockholm’. What if I
want to transform that value into hour like
Time.now.in_time_zone(time_zone).hour and search for that? Something
similar to:

@reminder = Reminder.find(:all, :conditions => [“reminder=? AND
#{Time.now.in_time_zone(time_zone_column).hour}=?”,‘daily’,8])

This statement doesn’t make sense to me. Translated to SQL it would look
something like:

– assuming it is the 7th hour in the given timezone
select * from reminders where reminder = ‘daily’ and 7 = 8;

The second part of the where clause will either be true for every row or
false for every row. It’s not comparing against columns in the database.