Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Shaun's Profile

GitHub User: shwing


Comments by Shaun


figured it out:

tz_names = ActiveSupport::TimeZone.zones_map.values.collect{|z| if z.utc_offset == offset}.compact!

I am trying to query all of the Users that share a common time zone offset (so I can send them an email at a particular time everyday), and can not figure it out!

User.where(:time_zone => ['list','of time','zone names'])

How do I get a list of the time zone names for a particular offset? I've been tinkering with TzInfo and ActiveSupport::TimeZone.zones_map with limited success.

Am I taking the wrong approach here? I was thinking I could store the GMT offset on the user instead, and query that way?

My google-fu has let me down on this one.