scopie 0.7.0 → 0.8.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 +13 -1
- data/lib/scopie/base.rb +4 -0
- data/lib/scopie/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e34647423993b787e22d9ac7e981916eb0762fd
|
4
|
+
data.tar.gz: 202a069ca12680313e90eb6d09da4e631a1f73a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25ab1c44e41e21bf8e33d4377aae792ec22825bddb8aa23d794a7502894f416999cd5bcae6e6f29e3c1046d82f8acfc3c1a22005ac21773a1482d698d4accb86
|
7
|
+
data.tar.gz: 7f4198b1614e31350b6f2a0615de4b24420f0d8367868c7937378c625a4005bffa5a23483d28bf26a70445397b66f1e14a020e25e14cff888a1915b90143ebb7
|
data/README.md
CHANGED
@@ -26,6 +26,7 @@ class Graduation < ActiveRecord::Base
|
|
26
26
|
|
27
27
|
scope :created_at_greater_than, ->(date) { where('entities.created_at >= ?', date.beginning_of_day) }
|
28
28
|
scope :created_at_less_than, ->(date) { where('entities.created_at <= ?', date.end_of_day) }
|
29
|
+
|
29
30
|
scope :updated_at_greater_than, ->(date) { where('entities.updated_at >= ?', date.beginning_of_day) }
|
30
31
|
scope :updated_at_less_than, ->(date) { where('entities.updated_at <= ?', date.end_of_day) }
|
31
32
|
|
@@ -43,6 +44,9 @@ class GraduationsScopie < Scopie::Base
|
|
43
44
|
has_scope :created_at_greater_than, in: :created_at, as: :start_at
|
44
45
|
has_scope :created_at_less_than, in: :created_at, as: :end_at
|
45
46
|
|
47
|
+
has_scope :updated_at_greater_than, in: :updated_at, as: :start_at, type: :date
|
48
|
+
has_scope :updated_at_less_than, in: :updated_at, as: :end_at, type: :date
|
49
|
+
|
46
50
|
has_scope :page, default: 1
|
47
51
|
has_scope :per, default: 30
|
48
52
|
|
@@ -61,6 +65,14 @@ class GraduationsScopie < Scopie::Base
|
|
61
65
|
scope.created_at_less_than(parse_date(value))
|
62
66
|
end
|
63
67
|
|
68
|
+
def updated_at_greater_than(scope, value, _hash)
|
69
|
+
scope.updated_at_greater_than(value)
|
70
|
+
end
|
71
|
+
|
72
|
+
def updated_at_less_than(scope, value, _hash)
|
73
|
+
scope.updated_at_less_than(value)
|
74
|
+
end
|
75
|
+
|
64
76
|
private
|
65
77
|
|
66
78
|
def parse_date(value)
|
@@ -113,7 +125,7 @@ gem 'scopie'
|
|
113
125
|
|
114
126
|
Scopie supports several options:
|
115
127
|
|
116
|
-
* `:type` - Coerces the type of the parameter sent. Available options: boolean, integer, date.
|
128
|
+
* `:type` - Coerces the type of the parameter sent. Available options: boolean, integer, float, date.
|
117
129
|
|
118
130
|
* `:only` - In which actions the scope is applied.
|
119
131
|
|
data/lib/scopie/base.rb
CHANGED
data/lib/scopie/version.rb
CHANGED