validates_overlap 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -0
- data/CONTRIBUTORS.md +26 -0
- data/MIT-LICENSE +2 -1
- data/README.md +33 -7
- data/lib/validates_overlap/overlap_validator.rb +1 -1
- data/lib/validates_overlap/version.rb +5 -0
- data/lib/validates_overlap.rb +2 -1
- metadata +54 -135
- data/.gitignore +0 -11
- data/.rspec +0 -2
- data/.rubocop.yml +0 -5
- data/.travis.yml +0 -6
- data/Gemfile +0 -3
- data/Gemfile.rails60 +0 -5
- data/Rakefile +0 -39
- data/VERSION +0 -1
- data/spec/dummy/Rakefile +0 -7
- data/spec/dummy/app/controllers/application_controller.rb +0 -3
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/models/active_meeting.rb +0 -4
- data/spec/dummy/app/models/document_with_enum.rb +0 -26
- data/spec/dummy/app/models/end_overlap_meeting.rb +0 -3
- data/spec/dummy/app/models/meeting.rb +0 -3
- data/spec/dummy/app/models/position.rb +0 -9
- data/spec/dummy/app/models/secure_meeting.rb +0 -3
- data/spec/dummy/app/models/shift.rb +0 -3
- data/spec/dummy/app/models/start_end_overlap_meeting.rb +0 -3
- data/spec/dummy/app/models/start_overlap_meeting.rb +0 -3
- data/spec/dummy/app/models/time_slot.rb +0 -8
- data/spec/dummy/app/models/user.rb +0 -2
- data/spec/dummy/app/models/user_meeting.rb +0 -3
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/config/application.rb +0 -45
- data/spec/dummy/config/boot.rb +0 -10
- data/spec/dummy/config/database.yml +0 -22
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -25
- data/spec/dummy/config/environments/production.rb +0 -49
- data/spec/dummy/config/environments/test.rb +0 -35
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/inflections.rb +0 -10
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/config/initializers/secret_token.rb +0 -7
- data/spec/dummy/config/initializers/session_store.rb +0 -8
- data/spec/dummy/config/locales/en.yml +0 -5
- data/spec/dummy/config/routes.rb +0 -58
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/db/migrate/20110406082020_create_meetings.rb +0 -13
- data/spec/dummy/db/migrate/20110406082053_create_users.rb +0 -13
- data/spec/dummy/db/migrate/20110407060725_create_user_meetings.rb +0 -15
- data/spec/dummy/db/migrate/20120509130956_create_end_overlap_meetings.rb +0 -13
- data/spec/dummy/db/migrate/20120509131012_create_start_overlap_meetings.rb +0 -13
- data/spec/dummy/db/migrate/20120509131032_create_start_end_overlap_meetings.rb +0 -13
- data/spec/dummy/db/migrate/20121207162212_create_time_slot.rb +0 -20
- data/spec/dummy/db/migrate/20130826155107_create_active_meetings.rb +0 -14
- data/spec/dummy/db/migrate/20150707155107_create_secure_meetings.rb +0 -14
- data/spec/dummy/db/migrate/20151203153132_create_shifts.rb +0 -13
- data/spec/dummy/db/migrate/20170102162952_add_documents_with_enum.rb +0 -14
- data/spec/dummy/db/schema.rb +0 -101
- data/spec/dummy/public/404.html +0 -26
- data/spec/dummy/public/422.html +0 -26
- data/spec/dummy/public/500.html +0 -26
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/javascripts/application.js +0 -2
- data/spec/dummy/public/javascripts/controls.js +0 -965
- data/spec/dummy/public/javascripts/dragdrop.js +0 -974
- data/spec/dummy/public/javascripts/effects.js +0 -1123
- data/spec/dummy/public/javascripts/prototype.js +0 -6001
- data/spec/dummy/public/javascripts/rails.js +0 -191
- data/spec/dummy/public/stylesheets/.gitkeep +0 -0
- data/spec/dummy/script/rails +0 -6
- data/spec/dummy/spec/factories/active_meeting.rb +0 -7
- data/spec/dummy/spec/factories/document_with_enum.rb +0 -7
- data/spec/dummy/spec/factories/end_overlap_meeting.rb +0 -6
- data/spec/dummy/spec/factories/meeting.rb +0 -6
- data/spec/dummy/spec/factories/position.rb +0 -6
- data/spec/dummy/spec/factories/secure_meeting.rb +0 -6
- data/spec/dummy/spec/factories/shift.rb +0 -6
- data/spec/dummy/spec/factories/start_end_overlap_meeting.rb +0 -6
- data/spec/dummy/spec/factories/start_overlap_meeting.rb +0 -6
- data/spec/dummy/spec/factories/time_slot.rb +0 -6
- data/spec/dummy/spec/factories/user.rb +0 -5
- data/spec/dummy/spec/factories/user_meeting.rb +0 -13
- data/spec/dummy/spec/models/active_meetings_spec.rb +0 -11
- data/spec/dummy/spec/models/document_with_enum_spec.rb +0 -53
- data/spec/dummy/spec/models/end_overlap_meeting_spec.rb +0 -48
- data/spec/dummy/spec/models/meeting_spec.rb +0 -68
- data/spec/dummy/spec/models/position_spec.rb +0 -31
- data/spec/dummy/spec/models/secure_meeting_spec.rb +0 -14
- data/spec/dummy/spec/models/shift_spec.rb +0 -41
- data/spec/dummy/spec/models/start_end_overlap_meeting_spec.rb +0 -48
- data/spec/dummy/spec/models/start_overlap_meeting_spec.rb +0 -48
- data/spec/dummy/spec/models/time_slot_spec.rb +0 -38
- data/spec/dummy/spec/models/user_meeting_spec.rb +0 -34
- data/spec/dummy/spec/models/user_spec.rb +0 -9
- data/spec/dummy/spec/overlap_validator_spec.rb +0 -32
- data/spec/spec_helper.rb +0 -58
- data/validates_overlap.gemspec +0 -30
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e43124f32b6ea56070aceb59e6149abff30b32a077150cee473e0142c75dbbcf
|
|
4
|
+
data.tar.gz: cd44ffa9dd62741e92cd0447df0da93680527535750b747cc298caeb284fbebb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ee62420473abe259fd2259296637b30945de74fe4b3a09d11dbd61dd0042479867d47fca0916f2bbbad3f75335ea51d02ae0b6c283ee9a593e939cc883efa323
|
|
7
|
+
data.tar.gz: 16f7b1c95f79023a49e33ed568cfeb7a2ab6af1398129f43a1469d22e07a68b77b570c84676ad2ea72c94606ef8a5abac9d55dcfe436e5a808c36dd7d7f633e7
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# ValidatesOverlap 1.x Change Log
|
|
2
|
+
|
|
3
|
+
## 1.1.0 (2026-08-07)
|
|
4
|
+
|
|
5
|
+
RSpec tests: **81 → 85** (+4 tests)
|
|
6
|
+
|
|
7
|
+
First release under new maintainership — [Tilo Sloboda](https://github.com/tilo) took over maintenance from [Robin Bortlik](https://github.com/robinbortlik) in August 2026. Thank you, Robin, for creating this gem and maintaining it for many years! ❤️
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- fixed [Issue #54](https://github.com/tilo/validates_overlap/issues/54): a scope naming an enum attribute as a symbol (e.g. `scope: [:kind]`) crashed with `NoMethodError`. Thanks to [Nujian Den Mark Meralpis](https://github.com/denmarkmeralpis) ([PR #55](https://github.com/tilo/validates_overlap/pull/55)); covered by a new regression test
|
|
12
|
+
|
|
13
|
+
### Improvements
|
|
14
|
+
|
|
15
|
+
- verified support for Rails 6.1, 7.0, 7.1, 7.2, 8.0, and 8.1 on Ruby 3.0–3.4 — an 18-cell GitHub Actions matrix now runs on every push (the first working CI since 2019)
|
|
16
|
+
- the gem now depends on `activerecord` instead of the full `rails` meta-gem, so it no longer pulls actionpack etc. into your bundle (version floor unchanged: `>= 6.0`)
|
|
17
|
+
- the gem package now ships only `lib/`, README, and license — previously the entire test app was packaged into the gem
|
|
18
|
+
- test suite modernized: migrated from the long-dead `factory_girl` to `factory_bot`, runs on current Ruby/Rails, SimpleCov added with 100% line coverage, new tests for nil scope values (`IS NULL` matching) and symbol enum scopes
|
|
19
|
+
- the gem version now lives in `ValidatesOverlap::VERSION` (`lib/validates_overlap/version.rb`); the `VERSION` file is gone
|
|
20
|
+
- README: badges, Ruby/Rails compatibility matrix, clearer description of what the gem does
|
|
21
|
+
|
|
22
|
+
## 1.0.0 (2019-11-17)
|
|
23
|
+
|
|
24
|
+
- Rails 6 support; support for Rails 3, 4, and 5 dropped — use version 0.8.6 for those. Thanks to [Robin Bortlik](https://github.com/robinbortlik)
|
|
25
|
+
- avoid implicit `scoped_model.all` delegation in the validation ([PR #52](https://github.com/tilo/validates_overlap/pull/52)). Thanks to [Ryuta Kamizono](https://github.com/kamipo)
|
|
26
|
+
- Russian validation error message ([PR #47](https://github.com/tilo/validates_overlap/pull/47)). Thanks to [Alexander Gornov](https://github.com/Zmokizmoghi)
|
|
27
|
+
|
|
28
|
+
## 0.8.6 (2017-11-20) and earlier
|
|
29
|
+
|
|
30
|
+
- releases from 2011 through 2017 by [Robin Bortlik](https://github.com/robinbortlik) and contributors were not tracked in a changelog; see the git history and [CONTRIBUTORS.md](CONTRIBUTORS.md)
|
data/CONTRIBUTORS.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# A Big Thank You to all 21 Contributors!!
|
|
2
|
+
|
|
3
|
+
`validates_overlap` was created in 2011 by [Robin Bortlik](https://github.com/robinbortlik), who designed it and maintained it, reviewing and merging every pull request below along the way. Thank you, Robin, for this gem and all the work you put into it! ❤️
|
|
4
|
+
|
|
5
|
+
A Big Thank you to everyone who filed issues, sent comments, and who contributed with pull requests:
|
|
6
|
+
|
|
7
|
+
* [Kyle Bolton](https://github.com/kb)
|
|
8
|
+
* [Jon Pascoe](https://github.com/pacso)
|
|
9
|
+
* [Mark Campbell](https://github.com/Nitrodist)
|
|
10
|
+
* [Thibaut Courouble](https://github.com/Thibaut)
|
|
11
|
+
* [Tawan Sierek](https://github.com/tawan)
|
|
12
|
+
* [Martin Lagrange](https://github.com/supertinou)
|
|
13
|
+
* [Geoff Harcourt](https://github.com/geoffharcourt)
|
|
14
|
+
* [Brenton 'B-Train' Fletcher](https://github.com/bloopletech)
|
|
15
|
+
* [Victor Hugo Bueno](https://github.com/victorbueno)
|
|
16
|
+
* [rmathew1992](https://github.com/rmathew1992)
|
|
17
|
+
* [Mikhail Dieterle](https://github.com/mikdiet)
|
|
18
|
+
* [Roberto Romero](https://github.com/sildur)
|
|
19
|
+
* [Patrick Smith](https://github.com/royalicing)
|
|
20
|
+
* [Rafał Trojanowski](https://github.com/rafaltrojanowski)
|
|
21
|
+
* [Szymon Rut](https://github.com/RutSzymon)
|
|
22
|
+
* [Alexander Gornov](https://github.com/Zmokizmoghi)
|
|
23
|
+
* [Ryuta Kamizono](https://github.com/kamipo)
|
|
24
|
+
* [Nujian Den Mark Meralpis](https://github.com/denmarkmeralpis)
|
|
25
|
+
* [ohenrik](https://github.com/ohenrik)
|
|
26
|
+
* [Jorge Santos](https://github.com/jsantos)
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
|
-
[](https://secure.travis-ci.org/robinbortlik/validates_overlap)
|
|
2
|
-
|
|
3
1
|
# ValidatesOverlap
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
#### This gem is compatible with Rails 6. If you are looking for version compatible with Rails 3,4,5 please use version 0.8.6 .
|
|
3
|
+
 [](https://github.com/tilo/validates_overlap/actions/workflows/ruby.yml) [](https://codecov.io/gh/tilo/validates_overlap) [](https://rubygems.org/gems/validates_overlap) [](https://rubygems.org/gems/validates_overlap) [](https://www.ruby-toolbox.com/projects/validates_overlap)
|
|
8
4
|
|
|
9
|
-
|
|
5
|
+
`validates_overlap` adds an overlap validation to ActiveRecord models.
|
|
10
6
|
Ideal solution for booking applications where you want to make sure, that one place can be booked only once in specific time period.
|
|
11
7
|
|
|
12
|
-
|
|
8
|
+
You name the two attributes that define a time range — for example starts_at and ends_at — and the validator checks with a single SQL query that no other record's range overlaps it. If one does, the record gets a normal validation error.
|
|
9
|
+
|
|
10
|
+
Typical uses: bookings, reservations, meetings, work shifts, rentals — anywhere a resource must not be double-booked for the same period.
|
|
11
|
+
|
|
12
|
+
The check runs entirely in the database, so no records are loaded to compare against. It supports scoping the comparison (per user, per room, …), open-ended ranges (a nil start or end counts as extending forever), ranges that may touch at the edges, required gaps between ranges, validating through associations, and loading the conflicting records when you want to show them to the user.
|
|
13
|
+
|
|
14
|
+
## Compatibility
|
|
15
|
+
|
|
16
|
+
Every combination below is verified on every push by the [CI matrix](https://github.com/tilo/validates_overlap/actions):
|
|
17
|
+
|
|
18
|
+
| Rails | Tested with Ruby |
|
|
19
|
+
|-------|--------------------|
|
|
20
|
+
| 8.1 | 3.2, 3.3, 3.4 |
|
|
21
|
+
| 8.0 | 3.2, 3.3, 3.4 |
|
|
22
|
+
| 7.2 | 3.1, 3.2, 3.3, 3.4 |
|
|
23
|
+
| 7.1 | 3.0, 3.1, 3.2, 3.3 |
|
|
24
|
+
| 7.0 | 3.0, 3.1, 3.2 |
|
|
25
|
+
| 6.1 | 3.0 |
|
|
26
|
+
|
|
27
|
+
The gemspec requires `activerecord >= 6.0`. Rails 6.0 is not part of the test matrix, but no incompatibilities are known. The previous version 0.8.6 was compatible with Rails 3, 4, and 5.
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
13
30
|
|
|
14
31
|
Add to your gemfile
|
|
15
32
|
|
|
@@ -90,3 +107,12 @@ class ActiveMeeting < ActiveRecord::Base
|
|
|
90
107
|
end
|
|
91
108
|
|
|
92
109
|
```
|
|
110
|
+
|
|
111
|
+
## Maintainership
|
|
112
|
+
|
|
113
|
+
`validates_overlap` was created by [Robin Bortlik](https://github.com/robinbortlik), who built and maintained it starting 2011.
|
|
114
|
+
Since August 2026 the gem is maintained by [Tilo Sloboda](https://github.com/tilo).
|
|
115
|
+
|
|
116
|
+
A big thank you to Robin for creating this awesome gem and for the years of work he put into it. ❤️
|
|
117
|
+
|
|
118
|
+
|
|
@@ -182,7 +182,7 @@ class OverlapValidator < ActiveModel::EachValidator
|
|
|
182
182
|
value = record.read_attribute(attr_name)
|
|
183
183
|
|
|
184
184
|
if is_enum_attribute?(record, attr_name)
|
|
185
|
-
value = record.class.defined_enums[attr_name][value]
|
|
185
|
+
value = record.class.defined_enums[attr_name.to_s][value]
|
|
186
186
|
end
|
|
187
187
|
|
|
188
188
|
value
|
data/lib/validates_overlap.rb
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
require_relative 'validates_overlap/version'
|
|
2
|
+
require_relative 'validates_overlap/overlap_validator'
|
metadata
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: validates_overlap
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robin Bortlik
|
|
8
|
-
|
|
8
|
+
- Tilo Sloboda
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
14
|
+
name: activerecord
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
@@ -25,7 +25,7 @@ dependencies:
|
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: 6.0.0
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
28
|
+
name: bundler
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - ">="
|
|
@@ -39,7 +39,7 @@ dependencies:
|
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
42
|
+
name: database_cleaner
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - ">="
|
|
@@ -53,7 +53,7 @@ dependencies:
|
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
56
|
+
name: factory_bot_rails
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
59
|
- - ">="
|
|
@@ -67,7 +67,7 @@ dependencies:
|
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: '0'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name:
|
|
70
|
+
name: pry
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
73
|
- - ">="
|
|
@@ -81,7 +81,7 @@ dependencies:
|
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
82
|
version: '0'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name:
|
|
84
|
+
name: rails
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements:
|
|
87
87
|
- - ">="
|
|
@@ -109,7 +109,7 @@ dependencies:
|
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '0'
|
|
111
111
|
- !ruby/object:Gem::Dependency
|
|
112
|
-
name:
|
|
112
|
+
name: rspec-rails
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
|
115
115
|
- - ">="
|
|
@@ -136,117 +136,63 @@ dependencies:
|
|
|
136
136
|
- - ">="
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
138
|
version: '0'
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: simplecov
|
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - ">="
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '0'
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - ">="
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '0'
|
|
153
|
+
- !ruby/object:Gem::Dependency
|
|
154
|
+
name: sqlite3
|
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
|
156
|
+
requirements:
|
|
157
|
+
- - ">="
|
|
158
|
+
- !ruby/object:Gem::Version
|
|
159
|
+
version: '0'
|
|
160
|
+
type: :development
|
|
161
|
+
prerelease: false
|
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
+
requirements:
|
|
164
|
+
- - ">="
|
|
165
|
+
- !ruby/object:Gem::Version
|
|
166
|
+
version: '0'
|
|
167
|
+
description: It can be useful when you are developing some app where you will work
|
|
168
|
+
with meetings, events etc.
|
|
169
|
+
email:
|
|
170
|
+
- robinbortlik@gmail.com
|
|
171
|
+
- tilo.sloboda@gmail.com
|
|
142
172
|
executables: []
|
|
143
173
|
extensions: []
|
|
144
174
|
extra_rdoc_files:
|
|
145
175
|
- README.md
|
|
146
176
|
files:
|
|
147
|
-
-
|
|
148
|
-
-
|
|
149
|
-
- ".rubocop.yml"
|
|
150
|
-
- ".travis.yml"
|
|
151
|
-
- Gemfile
|
|
152
|
-
- Gemfile.rails60
|
|
177
|
+
- CHANGELOG.md
|
|
178
|
+
- CONTRIBUTORS.md
|
|
153
179
|
- MIT-LICENSE
|
|
154
180
|
- README.md
|
|
155
|
-
- Rakefile
|
|
156
|
-
- VERSION
|
|
157
181
|
- lib/validates_overlap.rb
|
|
158
182
|
- lib/validates_overlap/locale/en.yml
|
|
159
183
|
- lib/validates_overlap/locale/es.yml
|
|
160
184
|
- lib/validates_overlap/locale/pt-BR.yml
|
|
161
185
|
- lib/validates_overlap/locale/ru.yml
|
|
162
186
|
- lib/validates_overlap/overlap_validator.rb
|
|
163
|
-
-
|
|
164
|
-
|
|
165
|
-
- spec/dummy/app/helpers/application_helper.rb
|
|
166
|
-
- spec/dummy/app/models/active_meeting.rb
|
|
167
|
-
- spec/dummy/app/models/document_with_enum.rb
|
|
168
|
-
- spec/dummy/app/models/end_overlap_meeting.rb
|
|
169
|
-
- spec/dummy/app/models/meeting.rb
|
|
170
|
-
- spec/dummy/app/models/position.rb
|
|
171
|
-
- spec/dummy/app/models/secure_meeting.rb
|
|
172
|
-
- spec/dummy/app/models/shift.rb
|
|
173
|
-
- spec/dummy/app/models/start_end_overlap_meeting.rb
|
|
174
|
-
- spec/dummy/app/models/start_overlap_meeting.rb
|
|
175
|
-
- spec/dummy/app/models/time_slot.rb
|
|
176
|
-
- spec/dummy/app/models/user.rb
|
|
177
|
-
- spec/dummy/app/models/user_meeting.rb
|
|
178
|
-
- spec/dummy/app/views/layouts/application.html.erb
|
|
179
|
-
- spec/dummy/config.ru
|
|
180
|
-
- spec/dummy/config/application.rb
|
|
181
|
-
- spec/dummy/config/boot.rb
|
|
182
|
-
- spec/dummy/config/database.yml
|
|
183
|
-
- spec/dummy/config/environment.rb
|
|
184
|
-
- spec/dummy/config/environments/development.rb
|
|
185
|
-
- spec/dummy/config/environments/production.rb
|
|
186
|
-
- spec/dummy/config/environments/test.rb
|
|
187
|
-
- spec/dummy/config/initializers/backtrace_silencers.rb
|
|
188
|
-
- spec/dummy/config/initializers/inflections.rb
|
|
189
|
-
- spec/dummy/config/initializers/mime_types.rb
|
|
190
|
-
- spec/dummy/config/initializers/secret_token.rb
|
|
191
|
-
- spec/dummy/config/initializers/session_store.rb
|
|
192
|
-
- spec/dummy/config/locales/en.yml
|
|
193
|
-
- spec/dummy/config/routes.rb
|
|
194
|
-
- spec/dummy/db/migrate/20110406082020_create_meetings.rb
|
|
195
|
-
- spec/dummy/db/migrate/20110406082053_create_users.rb
|
|
196
|
-
- spec/dummy/db/migrate/20110407060725_create_user_meetings.rb
|
|
197
|
-
- spec/dummy/db/migrate/20120509130956_create_end_overlap_meetings.rb
|
|
198
|
-
- spec/dummy/db/migrate/20120509131012_create_start_overlap_meetings.rb
|
|
199
|
-
- spec/dummy/db/migrate/20120509131032_create_start_end_overlap_meetings.rb
|
|
200
|
-
- spec/dummy/db/migrate/20121207162212_create_time_slot.rb
|
|
201
|
-
- spec/dummy/db/migrate/20130826155107_create_active_meetings.rb
|
|
202
|
-
- spec/dummy/db/migrate/20150707155107_create_secure_meetings.rb
|
|
203
|
-
- spec/dummy/db/migrate/20151203153132_create_shifts.rb
|
|
204
|
-
- spec/dummy/db/migrate/20170102162952_add_documents_with_enum.rb
|
|
205
|
-
- spec/dummy/db/schema.rb
|
|
206
|
-
- spec/dummy/public/404.html
|
|
207
|
-
- spec/dummy/public/422.html
|
|
208
|
-
- spec/dummy/public/500.html
|
|
209
|
-
- spec/dummy/public/favicon.ico
|
|
210
|
-
- spec/dummy/public/javascripts/application.js
|
|
211
|
-
- spec/dummy/public/javascripts/controls.js
|
|
212
|
-
- spec/dummy/public/javascripts/dragdrop.js
|
|
213
|
-
- spec/dummy/public/javascripts/effects.js
|
|
214
|
-
- spec/dummy/public/javascripts/prototype.js
|
|
215
|
-
- spec/dummy/public/javascripts/rails.js
|
|
216
|
-
- spec/dummy/public/stylesheets/.gitkeep
|
|
217
|
-
- spec/dummy/script/rails
|
|
218
|
-
- spec/dummy/spec/factories/active_meeting.rb
|
|
219
|
-
- spec/dummy/spec/factories/document_with_enum.rb
|
|
220
|
-
- spec/dummy/spec/factories/end_overlap_meeting.rb
|
|
221
|
-
- spec/dummy/spec/factories/meeting.rb
|
|
222
|
-
- spec/dummy/spec/factories/position.rb
|
|
223
|
-
- spec/dummy/spec/factories/secure_meeting.rb
|
|
224
|
-
- spec/dummy/spec/factories/shift.rb
|
|
225
|
-
- spec/dummy/spec/factories/start_end_overlap_meeting.rb
|
|
226
|
-
- spec/dummy/spec/factories/start_overlap_meeting.rb
|
|
227
|
-
- spec/dummy/spec/factories/time_slot.rb
|
|
228
|
-
- spec/dummy/spec/factories/user.rb
|
|
229
|
-
- spec/dummy/spec/factories/user_meeting.rb
|
|
230
|
-
- spec/dummy/spec/models/active_meetings_spec.rb
|
|
231
|
-
- spec/dummy/spec/models/document_with_enum_spec.rb
|
|
232
|
-
- spec/dummy/spec/models/end_overlap_meeting_spec.rb
|
|
233
|
-
- spec/dummy/spec/models/meeting_spec.rb
|
|
234
|
-
- spec/dummy/spec/models/position_spec.rb
|
|
235
|
-
- spec/dummy/spec/models/secure_meeting_spec.rb
|
|
236
|
-
- spec/dummy/spec/models/shift_spec.rb
|
|
237
|
-
- spec/dummy/spec/models/start_end_overlap_meeting_spec.rb
|
|
238
|
-
- spec/dummy/spec/models/start_overlap_meeting_spec.rb
|
|
239
|
-
- spec/dummy/spec/models/time_slot_spec.rb
|
|
240
|
-
- spec/dummy/spec/models/user_meeting_spec.rb
|
|
241
|
-
- spec/dummy/spec/models/user_spec.rb
|
|
242
|
-
- spec/dummy/spec/overlap_validator_spec.rb
|
|
243
|
-
- spec/spec_helper.rb
|
|
244
|
-
- validates_overlap.gemspec
|
|
245
|
-
homepage: http://github.com/robinbortlik/validates_overlap
|
|
187
|
+
- lib/validates_overlap/version.rb
|
|
188
|
+
homepage: https://github.com/tilo/validates_overlap
|
|
246
189
|
licenses:
|
|
247
190
|
- MIT
|
|
248
|
-
metadata:
|
|
249
|
-
|
|
191
|
+
metadata:
|
|
192
|
+
source_code_uri: https://github.com/tilo/validates_overlap/tree/v1.1.0
|
|
193
|
+
bug_tracker_uri: https://github.com/tilo/validates_overlap/issues
|
|
194
|
+
changelog_uri: https://github.com/tilo/validates_overlap/blob/main/CHANGELOG.md
|
|
195
|
+
rubygems_mfa_required: 'true'
|
|
250
196
|
rdoc_options: []
|
|
251
197
|
require_paths:
|
|
252
198
|
- lib
|
|
@@ -261,34 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
261
207
|
- !ruby/object:Gem::Version
|
|
262
208
|
version: '0'
|
|
263
209
|
requirements: []
|
|
264
|
-
|
|
265
|
-
rubygems_version: 2.7.3
|
|
266
|
-
signing_key:
|
|
210
|
+
rubygems_version: 4.0.17
|
|
267
211
|
specification_version: 4
|
|
268
212
|
summary: This gem helps validate records with time overlap.
|
|
269
|
-
test_files:
|
|
270
|
-
- spec/dummy/spec/factories/active_meeting.rb
|
|
271
|
-
- spec/dummy/spec/factories/document_with_enum.rb
|
|
272
|
-
- spec/dummy/spec/factories/end_overlap_meeting.rb
|
|
273
|
-
- spec/dummy/spec/factories/meeting.rb
|
|
274
|
-
- spec/dummy/spec/factories/position.rb
|
|
275
|
-
- spec/dummy/spec/factories/secure_meeting.rb
|
|
276
|
-
- spec/dummy/spec/factories/shift.rb
|
|
277
|
-
- spec/dummy/spec/factories/start_end_overlap_meeting.rb
|
|
278
|
-
- spec/dummy/spec/factories/start_overlap_meeting.rb
|
|
279
|
-
- spec/dummy/spec/factories/time_slot.rb
|
|
280
|
-
- spec/dummy/spec/factories/user.rb
|
|
281
|
-
- spec/dummy/spec/factories/user_meeting.rb
|
|
282
|
-
- spec/dummy/spec/models/active_meetings_spec.rb
|
|
283
|
-
- spec/dummy/spec/models/document_with_enum_spec.rb
|
|
284
|
-
- spec/dummy/spec/models/end_overlap_meeting_spec.rb
|
|
285
|
-
- spec/dummy/spec/models/meeting_spec.rb
|
|
286
|
-
- spec/dummy/spec/models/position_spec.rb
|
|
287
|
-
- spec/dummy/spec/models/secure_meeting_spec.rb
|
|
288
|
-
- spec/dummy/spec/models/shift_spec.rb
|
|
289
|
-
- spec/dummy/spec/models/start_end_overlap_meeting_spec.rb
|
|
290
|
-
- spec/dummy/spec/models/start_overlap_meeting_spec.rb
|
|
291
|
-
- spec/dummy/spec/models/time_slot_spec.rb
|
|
292
|
-
- spec/dummy/spec/models/user_meeting_spec.rb
|
|
293
|
-
- spec/dummy/spec/models/user_spec.rb
|
|
294
|
-
- spec/dummy/spec/overlap_validator_spec.rb
|
|
213
|
+
test_files: []
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Gemfile.rails60
DELETED
data/Rakefile
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
require 'rubygems'
|
|
2
|
-
require 'bundler'
|
|
3
|
-
require 'rake'
|
|
4
|
-
require 'rspec/core'
|
|
5
|
-
require 'rspec/core/rake_task'
|
|
6
|
-
require 'rdoc/task'
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
# Temporary fix of rake issue
|
|
10
|
-
# http://stackoverflow.com/questions/35893584/nomethoderror-undefined-method-last-comment-after-upgrading-to-rake-11/35893941
|
|
11
|
-
module TempFixForRakeLastComment
|
|
12
|
-
def last_comment
|
|
13
|
-
last_description
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
Rake::Application.send :include, TempFixForRakeLastComment
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
begin
|
|
20
|
-
Bundler::GemHelper.install_tasks
|
|
21
|
-
Bundler.setup(:default, :development)
|
|
22
|
-
rescue Bundler::BundlerError => e
|
|
23
|
-
$stderr.puts e.message
|
|
24
|
-
$stderr.puts 'Run `bundle install` to install missing gems'
|
|
25
|
-
exit e.status_code
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
RSpec::Core::RakeTask.new(:spec)
|
|
30
|
-
|
|
31
|
-
task default: :spec
|
|
32
|
-
|
|
33
|
-
Rake::RDocTask.new do |rdoc|
|
|
34
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ''
|
|
35
|
-
rdoc.rdoc_dir = 'rdoc'
|
|
36
|
-
rdoc.title = "validates_overlap #{version}"
|
|
37
|
-
rdoc.rdoc_files.include('README*')
|
|
38
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
39
|
-
end
|
data/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1.0.0
|
data/spec/dummy/Rakefile
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
|
2
|
-
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
|
3
|
-
|
|
4
|
-
require File.expand_path('../config/application', __FILE__)
|
|
5
|
-
require 'rake'
|
|
6
|
-
|
|
7
|
-
Dummy::Application.load_tasks
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
class DocumentWithEnum < ActiveRecord::Base
|
|
2
|
-
self.table_name = 'documents_with_enum'
|
|
3
|
-
KINDS = [:contract, :fact, :draft]
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (ActiveRecord::VERSION::MAJOR >= 5) || (ActiveRecord::VERSION::MAJOR > 4 && ActiveRecord::VERSION::MINOR > 1)
|
|
7
|
-
enum kind: KINDS
|
|
8
|
-
else
|
|
9
|
-
# Simulate enum functionality implemented in rails 4.1 and 5
|
|
10
|
-
# For rails version < 4.1 we always read read attribute by using read_attribute method
|
|
11
|
-
def kind=(value)
|
|
12
|
-
write_attribute(:kind, KINDS.index(value))
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def kind
|
|
16
|
-
return nil if read_attribute(:kind).nil?
|
|
17
|
-
KINDS[read_attribute(:kind).to_i]
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
validates :valid_from, :valid_until, overlap: {
|
|
23
|
-
exclude_edges: ['valid_from', 'valid_until'],
|
|
24
|
-
scope: ['kind']
|
|
25
|
-
}
|
|
26
|
-
end
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
class Position < ActiveRecord::Base
|
|
2
|
-
belongs_to :time_slot
|
|
3
|
-
belongs_to :user
|
|
4
|
-
validates :"time_slots.starts_at", :"time_slots.ends_at",
|
|
5
|
-
overlap: {
|
|
6
|
-
query_options: { joins: :time_slot },
|
|
7
|
-
scope: { 'positions.user_id' => proc { |position| position.user_id } }
|
|
8
|
-
}
|
|
9
|
-
end
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
class TimeSlot < ActiveRecord::Base
|
|
2
|
-
has_many :positions
|
|
3
|
-
validates :"time_slots.starts_at", :"time_slots.ends_at",
|
|
4
|
-
overlap: {
|
|
5
|
-
query_options: { joins: :positions },
|
|
6
|
-
scope: { 'positions.user_id' => proc { |time_slot| time_slot.positions.map(&:user_id) } }
|
|
7
|
-
}
|
|
8
|
-
end
|