Differences in execution between console and app

It's not a problem of iterating over the range, cause as you've pointed out you can iterate over a range of dates.

Looks like it's either a bug in the client code or maybe something weird about AR's #find_all_by...

I would simplify this in order to debug. First just yield the date itself and don't worry about the appointments. Take out all the appointment display code.

The other possibility (unlikely though) is some weirdness in find_all_by like I said. Try changing the call to appointments.find(:all, :conditions => ["date=?", Date.today])

but as you can see, you're iterating through the dates fine. There's just something strange happening in the code that's being called via yield, or perhaps something funky under the hood.

Pat