Posts

Showing posts from December, 2014

Date within range + Rails

Image
Here is a basic example to determine whether todays date feature within a particular range. Creating an instance method inside model, this method will return true or false def notification_required? start_date = 15.days.ago.to_date end_date = Date.today (start_date..end_date).include_with_range?(self.last_notification_sent_at) end And to use this method @user.notification_required?