Please sign in to comment.
Prefer cover? over include? for validates_includes/validates_inclusio…
…n_of On ruby 1.9, non-numeric ranges (such as date ranges) are treated differently than 1.8 in regards to include?. In 1.8 include? just checked against the beginning and end of the range, now it checks each object in the range to see if it matches. The 1.8 include? behavior is now known as cover?. This is a simple switch to use cover? if available, and fallback to include? if not.
- Loading branch information...
Showing with 10 additions and 7 deletions.