activerecord 5.2.0.rc2 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activerecord might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -12
- data/lib/active_record/associations/preloader/association.rb +2 -2
- data/lib/active_record/connection_adapters/mysql2_adapter.rb +1 -1
- data/lib/active_record/gem_version.rb +1 -1
- data/lib/active_record/locking/pessimistic.rb +1 -1
- data/lib/active_record/persistence.rb +1 -1
- data/lib/active_record/relation.rb +9 -0
- data/lib/active_record/relation/delegation.rb +5 -0
- data/lib/active_record/scoping/named.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a81ce578a98474e193314f6d806ee2f910d9d651fab445a14595154c41f6401
|
4
|
+
data.tar.gz: 1a45823e0f6e0af4759af73c37e3a1b76bb9584e168b553bcfbca3208d2211e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6390719d7140cda11b175cfb8c4ad62e502204a202a70d6bf532131f323b49f120c30ca8e28d9e35335bb03d52a596ae7dcdfb3b05e762ae78150c70625adae
|
7
|
+
data.tar.gz: cc85711ffcbec0a1b04b4f9940c0752687f9b98e7b65950cf46b28df14c13c9399d15699134bb3c5835bd76fdc8b944b0a661483c685075605b270f3bbe774d0
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
## Rails 5.2.0
|
1
|
+
## Rails 5.2.0 (April 09, 2018) ##
|
2
|
+
|
3
|
+
* MySQL: Support mysql2 0.5.x.
|
4
|
+
|
5
|
+
*Aaron Stone*
|
2
6
|
|
3
7
|
* Apply time column precision on assignment.
|
4
8
|
|
@@ -56,9 +60,6 @@
|
|
56
60
|
|
57
61
|
*Ryuta Kamizono*
|
58
62
|
|
59
|
-
|
60
|
-
## Rails 5.2.0.rc1 (January 30, 2018) ##
|
61
|
-
|
62
63
|
* PostgreSQL: Allow pg-1.0 gem to be used with Active Record.
|
63
64
|
|
64
65
|
*Lars Kanis*
|
@@ -289,14 +290,6 @@
|
|
289
290
|
|
290
291
|
*kinnrot*
|
291
292
|
|
292
|
-
|
293
|
-
## Rails 5.2.0.beta2 (November 28, 2017) ##
|
294
|
-
|
295
|
-
* No changes.
|
296
|
-
|
297
|
-
|
298
|
-
## Rails 5.2.0.beta1 (November 27, 2017) ##
|
299
|
-
|
300
293
|
* Add new error class `QueryCanceled` which will be raised
|
301
294
|
when canceling statement due to user request.
|
302
295
|
|
@@ -43,11 +43,11 @@ module ActiveRecord
|
|
43
43
|
|
44
44
|
def associate_records_to_owner(owner, records)
|
45
45
|
association = owner.association(reflection.name)
|
46
|
+
association.loaded!
|
46
47
|
if reflection.collection?
|
47
|
-
association.loaded!
|
48
48
|
association.target.concat(records)
|
49
49
|
else
|
50
|
-
association.target = records.first
|
50
|
+
association.target = records.first unless records.empty?
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -62,7 +62,7 @@ module ActiveRecord
|
|
62
62
|
# the locked record.
|
63
63
|
def lock!(lock = true)
|
64
64
|
if persisted?
|
65
|
-
if
|
65
|
+
if has_changes_to_save?
|
66
66
|
raise(<<-MSG.squish)
|
67
67
|
Locking a record with unpersisted changes is not supported. Use
|
68
68
|
`save` to persist the changes, or `reload` to discard them
|
@@ -656,7 +656,7 @@ module ActiveRecord
|
|
656
656
|
end
|
657
657
|
|
658
658
|
attribute_names = timestamp_attributes_for_update_in_model
|
659
|
-
attribute_names.
|
659
|
+
attribute_names |= names.map(&:to_s)
|
660
660
|
|
661
661
|
unless attribute_names.empty?
|
662
662
|
affected_rows = _touch_row(attribute_names, time)
|
@@ -29,6 +29,7 @@ module ActiveRecord
|
|
29
29
|
@offsets = {}
|
30
30
|
@loaded = false
|
31
31
|
@predicate_builder = predicate_builder
|
32
|
+
@delegate_to_klass = false
|
32
33
|
end
|
33
34
|
|
34
35
|
def initialize_copy(other)
|
@@ -282,6 +283,13 @@ module ActiveRecord
|
|
282
283
|
klass.current_scope = previous
|
283
284
|
end
|
284
285
|
|
286
|
+
def _exec_scope(*args, &block) # :nodoc:
|
287
|
+
@delegate_to_klass = true
|
288
|
+
instance_exec(*args, &block) || self
|
289
|
+
ensure
|
290
|
+
@delegate_to_klass = false
|
291
|
+
end
|
292
|
+
|
285
293
|
# Updates all records in the current relation with details given. This method constructs a single SQL UPDATE
|
286
294
|
# statement and sends it straight to the database. It does not instantiate the involved models and it does not
|
287
295
|
# trigger Active Record callbacks or validations. However, values passed to #update_all will still go through
|
@@ -415,6 +423,7 @@ module ActiveRecord
|
|
415
423
|
end
|
416
424
|
|
417
425
|
def reset
|
426
|
+
@delegate_to_klass = false
|
418
427
|
@to_sql = @arel = @loaded = @should_eager_load = nil
|
419
428
|
@records = [].freeze
|
420
429
|
@offsets = {}
|
@@ -82,6 +82,11 @@ module ActiveRecord
|
|
82
82
|
if @klass.respond_to?(method)
|
83
83
|
self.class.delegate_to_scoped_klass(method)
|
84
84
|
scoping { @klass.public_send(method, *args, &block) }
|
85
|
+
elsif @delegate_to_klass && @klass.respond_to?(method, true)
|
86
|
+
ActiveSupport::Deprecation.warn \
|
87
|
+
"Delegating missing #{method} method to #{@klass}. " \
|
88
|
+
"Accessibility of private/protected class methods in :scope is deprecated and will be removed in Rails 6.0."
|
89
|
+
@klass.send(method, *args, &block)
|
85
90
|
elsif arel.respond_to?(method)
|
86
91
|
ActiveSupport::Deprecation.warn \
|
87
92
|
"Delegating #{method} to arel is deprecated and will be removed in Rails 6.0."
|
@@ -183,7 +183,7 @@ module ActiveRecord
|
|
183
183
|
if body.respond_to?(:to_proc)
|
184
184
|
singleton_class.send(:define_method, name) do |*args|
|
185
185
|
scope = all
|
186
|
-
scope = scope.
|
186
|
+
scope = scope._exec_scope(*args, &body)
|
187
187
|
scope = scope.extending(extension) if extension
|
188
188
|
scope
|
189
189
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.2.0
|
4
|
+
version: 5.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.2.0
|
19
|
+
version: 5.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.2.0
|
26
|
+
version: 5.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activemodel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 5.2.0
|
33
|
+
version: 5.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 5.2.0
|
40
|
+
version: 5.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: arel
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -307,8 +307,8 @@ homepage: http://rubyonrails.org
|
|
307
307
|
licenses:
|
308
308
|
- MIT
|
309
309
|
metadata:
|
310
|
-
source_code_uri: https://github.com/rails/rails/tree/v5.2.0
|
311
|
-
changelog_uri: https://github.com/rails/rails/blob/v5.2.0
|
310
|
+
source_code_uri: https://github.com/rails/rails/tree/v5.2.0/activerecord
|
311
|
+
changelog_uri: https://github.com/rails/rails/blob/v5.2.0/activerecord/CHANGELOG.md
|
312
312
|
post_install_message:
|
313
313
|
rdoc_options:
|
314
314
|
- "--main"
|
@@ -322,9 +322,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
322
322
|
version: 2.2.2
|
323
323
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
324
324
|
requirements:
|
325
|
-
- - "
|
325
|
+
- - ">="
|
326
326
|
- !ruby/object:Gem::Version
|
327
|
-
version:
|
327
|
+
version: '0'
|
328
328
|
requirements: []
|
329
329
|
rubyforge_project:
|
330
330
|
rubygems_version: 2.7.6
|