Installing PostgreSQL on Snow Leopard 10.6

Good news! Whether you are using PostgreSQL for general development, or need a version to match your setup on Heroku, getting PostgreSQL 8.3 installed on Snow Leopard is fairly straight forward. However, you’ll want to make some changes so that it works right for you.
Continue reading “Installing PostgreSQL on Snow Leopard 10.6”

Fixing Ruby Gems, MySQL and Passenger Phusion on Snow Leopard 10.6

One of the first things I noticed after upgrading to Snow Leopard is that my Passenger based sites stopped working. I use this heavily for Rails development, so I needed it fixed. The first thing I tried was reinstalling Passenger Phusion, which led to an error.
Continue reading “Fixing Ruby Gems, MySQL and Passenger Phusion on Snow Leopard 10.6”

Is Delayed Job :run_at => DateTime Giving You Fits?

I’ve been implementing Delayed Job to poll Twitter every minute for changes. However, it was immediately running everything and ignoring the run_at time in the database. Or so I thought.

Upon inspection of the code for Delayed Job, it is polling the database time to UTC and not local time.

def self.db_time_now
      (ActiveRecord::Base.default_timezone == :utc) ? Time.now.utc : Time.now
end

What was

Delayed::Job.enqueue PollTwitter.new(), 0, 1.minutes.from_now

has now become

Delayed::Job.enqueue PollTwitter.new(), 0, 1.minutes.from_now.getutc

Four hours is a large difference.

Note: Normally I would just run this as a cron job, but Heroku will only run cron once per hour.