Ruby Dates
In one of my apps, the price of registration for an event goes up after a particular date. So I have to check if today’s date is after the given date. Here’s how I’ll do this:
irb(main):006:0> @x = Date.today => Fri, 17 May 2013 irb(main):007:0> @x > "16 May 2013".to_date => true irb(main):008:0> @x > "18 May 2013".to_date => false
So I should just be able to add a line to my calculate_payment method that checks the date and returns the correct price. This should be pretty easy.