Working with a Rails 3 application. Given a DateTime, I need to produce the Datetime for the previous Sunday. If the DateTime is a Sunday, then I want that Sunday itself back. Here's some examples:
November 7, 2011 => November 6, 2011 November 6, 2011 => November 6, 2011 November 5, 2011 => October 30, 2011
Any ideas? I'm a bit stuck.