Posts

Showing posts from July, 2014

May #TMIL - A Touch of eval()

In a Rails app, I've got a Plan that belongs to a Subscription. The Plan has a duration, and the Subscription has an expiration. The expiration gets set in an after_create callback using the current time (DateTime.now) plus the Plan's duration. Then, there's an expired? method on the Subscription which checks if self.expiration < DateTime.now . Pretty straightforward, right? (code snippet below)