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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05ffc10283f2de5fa74bacff7a6368636f62e8ddb263dd33d191502c0b418edc
4
- data.tar.gz: 887827ef96299b9916f97e554706e670e83c99dad2522755c760348bdd3077cf
3
+ metadata.gz: 733ede5e2375b5b97d951b5ef313d8cd09843250f5c64bb6f611945b951f9156
4
+ data.tar.gz: e753145a244b5f7dc3ac58127edc301ea656eca3cadd702112b1fe54f798c6d5
5
5
  SHA512:
6
- metadata.gz: 5d8cdf01f590ff7575539e39e9207e14eac7bd04417483fe453a7f1fb281e9bf9869678fbb7e2cc2381ccdfb678f47c6ca82b644ea291149ed48fdfba61963a3
7
- data.tar.gz: 190dd79d14e7b00a7aa5492a46cfa18d50b56af08bd489fc8e68560530e0edb91a124932a24444116dd0cda09c926834c9ac33ed2b4b8c5117601e24b2ee0eac
6
+ metadata.gz: e182d88f6d17a55465590c1096c942ca62d79107ce244509cb9350dd6587ac3ec5ff99d65a06c45c31416232d34c20764094ef895b3f28be3657959ef0791ef1
7
+ data.tar.gz: '095c5500b970a6654b7f21dcdbaec7ee3a80146ce15de4c5e124ac2f9a6afb31dd2e155ec8f90db629658de3ff1ebc416fc8620c4e8dd2464ff2d3b175548e09'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 5.2.3 (2021-12-06)
2
+
3
+ - Fixed error and warnings with Active Record 7
4
+
1
5
  ## 5.2.2 (2021-02-08)
2
6
 
3
7
  - Added support for `nil..nil` ranges in `range` option
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 relation.default_timezone == :local
20
- raise Groupdate::Error, "ActiveRecord::Base.default_timezone must be :utc to use Groupdate"
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
 
@@ -1,3 +1,3 @@
1
1
  module Groupdate
2
- VERSION = "5.2.2"
2
+ VERSION = "5.2.3"
3
3
  end
data/lib/groupdate.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # dependencies
2
+ require "active_support"
2
3
  require "active_support/core_ext/module/attribute_accessors"
3
4
  require "active_support/time"
4
5
 
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.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-02-08 00:00:00.000000000 Z
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.3
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