Don't use include? for checking if Date is in Range
Following will instantiate every date between start_date and end_date, and then check if date is in that set:
(start_date..end_date).include?(date)
That could take a while. Instead use:
(start_date..end_date).cover?(date)
It uses >= and '<=' methods on Range boundaries.
Written by Adam Stankiewicz
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
 #Ruby 
Authors
Related Tags
#ruby
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#