groupdate 5.2.2 → 5.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +8 -2
- data/lib/groupdate/adapters/base_adapter.rb +8 -2
- data/lib/groupdate/version.rb +1 -1
- data/lib/groupdate.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 733ede5e2375b5b97d951b5ef313d8cd09843250f5c64bb6f611945b951f9156
|
4
|
+
data.tar.gz: e753145a244b5f7dc3ac58127edc301ea656eca3cadd702112b1fe54f798c6d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e182d88f6d17a55465590c1096c942ca62d79107ce244509cb9350dd6587ac3ec5ff99d65a06c45c31416232d34c20764094ef895b3f28be3657959ef0791ef1
|
7
|
+
data.tar.gz: '095c5500b970a6654b7f21dcdbaec7ee3a80146ce15de4c5e124ac2f9a6afb31dd2e155ec8f90db629658de3ff1ebc416fc8620c4e8dd2464ff2d3b175548e09'
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -223,6 +223,14 @@ raise "Unpermitted column" unless ["column_a", "column_b"].include?(column)
|
|
223
223
|
User.group_by_day(column).count
|
224
224
|
```
|
225
225
|
|
226
|
+
### Default Scopes
|
227
|
+
|
228
|
+
If you use Postgres and have a default scope that uses `order`, you may get a `column must appear in the GROUP BY clause` error (just like with Active Record’s `group` method). Remove the `order` scope with:
|
229
|
+
|
230
|
+
```ruby
|
231
|
+
User.unscope(:order).group_by_day(:count).count
|
232
|
+
```
|
233
|
+
|
226
234
|
## Arrays and Hashes
|
227
235
|
|
228
236
|
```ruby
|
@@ -257,8 +265,6 @@ users.group_by_day { |u| u.created_at }.map { |k, v| [k, v.count] }.to_h
|
|
257
265
|
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql
|
258
266
|
```
|
259
267
|
|
260
|
-
or copy and paste [these statements](https://gist.githubusercontent.com/ankane/1d6b0022173186accbf0/raw/time_zone_support.sql) into a SQL console.
|
261
|
-
|
262
268
|
You can confirm it worked with:
|
263
269
|
|
264
270
|
```sql
|
@@ -16,8 +16,14 @@ module Groupdate
|
|
16
16
|
@day_start = day_start
|
17
17
|
@n_seconds = n_seconds
|
18
18
|
|
19
|
-
if
|
20
|
-
|
19
|
+
if ActiveRecord::VERSION::MAJOR >= 7
|
20
|
+
if ActiveRecord.default_timezone == :local
|
21
|
+
raise Groupdate::Error, "ActiveRecord.default_timezone must be :utc to use Groupdate"
|
22
|
+
end
|
23
|
+
else
|
24
|
+
if relation.default_timezone == :local
|
25
|
+
raise Groupdate::Error, "ActiveRecord::Base.default_timezone must be :utc to use Groupdate"
|
26
|
+
end
|
21
27
|
end
|
22
28
|
end
|
23
29
|
|
data/lib/groupdate/version.rb
CHANGED
data/lib/groupdate.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groupdate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.2.
|
4
|
+
version: 5.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '0'
|
68
68
|
requirements: []
|
69
|
-
rubygems_version: 3.2.
|
69
|
+
rubygems_version: 3.2.32
|
70
70
|
signing_key:
|
71
71
|
specification_version: 4
|
72
72
|
summary: The simplest way to group temporal data
|