Skip to content

Latest commit

 

History

History
27 lines (17 loc) · 837 Bytes

File metadata and controls

27 lines (17 loc) · 837 Bytes

<img src=“https://secure.travis-ci.org/robinbortlik/validates_overlap.png?branch=master” alt=“Build Status” />

This project rocks and uses MIT-LICENSE.

If you are developing Rails 3 app, let say some meeting planner and you can’t save records which have time overlap.

Add to your gemfile

gem 'validates_overlap'

In your model

without scope

validates :starts_at, :ends_at, :overlap => true

with scope

validates :starts_at, :ends_at, :overlap => {:scope => "user_id"}

exclude edges

validates :starts_at, :ends_at, :overlap => {:exclude_edges => "starts_at"}
validates :starts_at, :ends_at, :overlap => {:exclude_edges => ["starts_at", "ends_at"]}