scopy 2.0.0 → 3.0.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/README.md +11 -21
- data/lib/scopy.rb +0 -1
- data/lib/scopy/version.rb +1 -1
- metadata +1 -2
- data/lib/scopy/id_scopes.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb9f1042b50dd5958699ea986afe44d6ca843c862d9ff1b00faf7a6eaa59d08f
|
4
|
+
data.tar.gz: 0f9f83ba0699543cfd3ba55244399e2f63d96052186024a443b6bb8e7613ea0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5598b2503f9f11c3c1382e63840f84be2bec529f4a8d8a650cbfe53140fd91d8c512053ccfb5cbbf69e46723b73294286a28a8ab73af54fb71d31f8b521b16e7
|
7
|
+
data.tar.gz: 3c88b4270d6f42c1f51b1d483121254dc44b640cf1d22d9afddb824f637465c102986cd54e03cc7a4c0f5934a72fac1964598fbd5643f55985af36c35d332fee
|
data/README.md
CHANGED
@@ -8,7 +8,6 @@ Scopy provides common ActiveRecord scopes as ActiveSupport model concerns.
|
|
8
8
|
Common scopes for the following attributes are provided:
|
9
9
|
|
10
10
|
* `created_at`
|
11
|
-
* `id`
|
12
11
|
* `name`
|
13
12
|
|
14
13
|
## Install
|
@@ -30,7 +29,6 @@ Include the modules you would like to use in your models:
|
|
30
29
|
```ruby
|
31
30
|
class Dog < ActiveRecord::Base
|
32
31
|
include Scopy::CreatedAtScopes
|
33
|
-
include Scopy::IdScopes
|
34
32
|
include Scopy::NameScopes
|
35
33
|
```
|
36
34
|
|
@@ -67,25 +65,6 @@ Dog.created_in_year(Time.new(2013))
|
|
67
65
|
# => dogs created in 2013
|
68
66
|
```
|
69
67
|
|
70
|
-
##### Scopy::IdScopes
|
71
|
-
|
72
|
-
```ruby
|
73
|
-
Dog.excluding(123)
|
74
|
-
# => dogs excluding id 123
|
75
|
-
|
76
|
-
Dog.excluding([1, 2, 3])
|
77
|
-
# => dogs excluding ids 1, 2, and 3
|
78
|
-
|
79
|
-
Dog.excluding(dog)
|
80
|
-
# => dogs excluding dog
|
81
|
-
|
82
|
-
Dog.excluding(Dog.where(id: [1, 2]))
|
83
|
-
# => dogs excluding other dogs
|
84
|
-
```
|
85
|
-
|
86
|
-
Note: `.excluding_ids` and `.excluding_id` scopes were removed in
|
87
|
-
version 2.0. Replace those calls with `.excluding`.
|
88
|
-
|
89
68
|
##### Scopy::NameScopes
|
90
69
|
|
91
70
|
```ruby
|
@@ -101,3 +80,14 @@ Dog.name_starts_with('snOOp')
|
|
101
80
|
Dog.name_starts_with('Snoop', case_sensitive: true)
|
102
81
|
# => dogs with names starting with 'Snoop' (case sensitive)
|
103
82
|
```
|
83
|
+
|
84
|
+
#### Upgrading
|
85
|
+
|
86
|
+
##### Version 2.0
|
87
|
+
|
88
|
+
* `.excluding_ids` and `.excluding_id` scopes were removed in
|
89
|
+
version 2.0. Replace those calls with `.excluding`.
|
90
|
+
|
91
|
+
##### Version 3.0
|
92
|
+
|
93
|
+
* `Scopy::IdScopes` was removed in version 3. Use `where.not(id: ids)`.
|
data/lib/scopy.rb
CHANGED
data/lib/scopy/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scopy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tee Parham
|
@@ -91,7 +91,6 @@ files:
|
|
91
91
|
- README.md
|
92
92
|
- lib/scopy.rb
|
93
93
|
- lib/scopy/created_at_scopes.rb
|
94
|
-
- lib/scopy/id_scopes.rb
|
95
94
|
- lib/scopy/name_scopes.rb
|
96
95
|
- lib/scopy/version.rb
|
97
96
|
homepage: https://github.com/neighborland/scopy
|
data/lib/scopy/id_scopes.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
module Scopy
|
2
|
-
module IdScopes
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
included do
|
6
|
-
# objects may be:
|
7
|
-
# one id
|
8
|
-
# an array of ids
|
9
|
-
# one model
|
10
|
-
# a relation or array of models
|
11
|
-
scope :excluding, -> (objects) { where.not(id: Array.wrap(objects)) }
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|