activerecord 4.2.7.1 → 4.2.8.rc1
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 +31 -0
- data/lib/active_record.rb +2 -1
- data/lib/active_record/aggregations.rb +3 -1
- data/lib/active_record/associations/collection_association.rb +13 -6
- data/lib/active_record/associations/collection_proxy.rb +2 -2
- data/lib/active_record/associations/join_dependency/join_association.rb +9 -1
- data/lib/active_record/attribute_assignment.rb +1 -1
- data/lib/active_record/attribute_methods.rb +1 -1
- data/lib/active_record/attribute_methods/write.rb +1 -1
- data/lib/active_record/attributes.rb +1 -0
- data/lib/active_record/connection_adapters/abstract/connection_pool.rb +1 -1
- data/lib/active_record/connection_adapters/abstract/quoting.rb +1 -0
- data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +2 -2
- data/lib/active_record/connection_adapters/mysql2_adapter.rb +4 -10
- data/lib/active_record/connection_adapters/postgresql/oid/array.rb +1 -0
- data/lib/active_record/gem_version.rb +2 -2
- data/lib/active_record/model_schema.rb +1 -1
- data/lib/active_record/relation/calculations.rb +1 -1
- data/lib/active_record/schema_migration.rb +1 -4
- data/lib/active_record/type/value.rb +5 -0
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7354a19acea0291b17f2dc0f4461d9168a4ce4e4
|
4
|
+
data.tar.gz: 175ee018440a7a47aa915b2a4568db0fc23e0e15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8326290b48e0607c91e088535bcfcc395309a3eedce5679933f4232ffe0808027e7d2c728be46cbbcb3425898a1651141b93dd0e6ea0ca8df00ad037e801b111
|
7
|
+
data.tar.gz: '09429829149e69921ff2f262d719b4a7570e47d4e4dd5c3d25d68320ee540420196fb5a30faa237d723b05d6b0a448701cbe531d05e11b9f1ce24e8d2d6048cf'
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,34 @@
|
|
1
|
+
## Rails 4.2.8.rc1 (February 09, 2017) ##
|
2
|
+
|
3
|
+
* Using a mysql2 connection after it fails to reconnect will now have an error message
|
4
|
+
saying the connection is closed rather than an undefined method error message.
|
5
|
+
|
6
|
+
*Dylan Thacker-Smith*
|
7
|
+
|
8
|
+
* Bust Model.attribute_names cache when resetting column information
|
9
|
+
|
10
|
+
*James Coleman*
|
11
|
+
|
12
|
+
* Fix query caching when type information is reset
|
13
|
+
|
14
|
+
Backports ancillary fix in 5.0.
|
15
|
+
|
16
|
+
*James Coleman*
|
17
|
+
|
18
|
+
* Allow `joins` to be unscoped.
|
19
|
+
|
20
|
+
Fixes #13775.
|
21
|
+
|
22
|
+
*Takashi Kokubun*
|
23
|
+
|
24
|
+
* Hashes can once again be passed to setters of `composed_of`, if all of the
|
25
|
+
mapping methods are methods implemented on `Hash`.
|
26
|
+
|
27
|
+
Fixes #25978.
|
28
|
+
|
29
|
+
*Sean Griffin*
|
30
|
+
|
31
|
+
|
1
32
|
## Rails 4.2.7 (July 12, 2016) ##
|
2
33
|
|
3
34
|
* Inspecting an object with an associated array of over 10 elements no longer
|
data/lib/active_record.rb
CHANGED
@@ -43,7 +43,6 @@ module ActiveRecord
|
|
43
43
|
autoload :Explain
|
44
44
|
autoload :Inheritance
|
45
45
|
autoload :Integration
|
46
|
-
autoload :LegacyYamlAdapter
|
47
46
|
autoload :Migration
|
48
47
|
autoload :Migrator, 'active_record/migration'
|
49
48
|
autoload :ModelSchema
|
@@ -80,6 +79,8 @@ module ActiveRecord
|
|
80
79
|
autoload :AttributeMethods
|
81
80
|
autoload :AutosaveAssociation
|
82
81
|
|
82
|
+
autoload :LegacyYamlAdapter
|
83
|
+
|
83
84
|
autoload :Relation
|
84
85
|
autoload :AssociationRelation
|
85
86
|
autoload :NullRelation
|
@@ -249,7 +249,9 @@ module ActiveRecord
|
|
249
249
|
part = converter.respond_to?(:call) ? converter.call(part) : klass.send(converter, part)
|
250
250
|
end
|
251
251
|
|
252
|
-
|
252
|
+
hash_from_multiparameter_assignment = part.is_a?(Hash) &&
|
253
|
+
part.each_key.all? { |k| k.is_a?(Integer) }
|
254
|
+
if hash_from_multiparameter_assignment
|
253
255
|
part = klass.new(*part.values)
|
254
256
|
end
|
255
257
|
|
@@ -61,10 +61,17 @@ module ActiveRecord
|
|
61
61
|
|
62
62
|
# Implements the ids writer method, e.g. foo.item_ids= for Foo.has_many :items
|
63
63
|
def ids_writer(ids)
|
64
|
-
|
65
|
-
|
66
|
-
ids.map
|
67
|
-
|
64
|
+
pk_column = reflection.association_primary_key
|
65
|
+
pk_type = klass.type_for_attribute(pk_column)
|
66
|
+
ids = Array(ids).reject(&:blank?).map do |i|
|
67
|
+
pk_type.type_cast_from_user(i)
|
68
|
+
end
|
69
|
+
|
70
|
+
if (objs = klass.where(pk_column => ids)).size == ids.size
|
71
|
+
replace(objs.index_by { |r| r.send(pk_column) }.values_at(*ids))
|
72
|
+
else
|
73
|
+
objs.raise_record_not_found_exception!(ids, objs.size, ids.size)
|
74
|
+
end
|
68
75
|
end
|
69
76
|
|
70
77
|
def reset
|
@@ -264,7 +271,7 @@ module ActiveRecord
|
|
264
271
|
_options = records.extract_options!
|
265
272
|
dependent = _options[:dependent] || options[:dependent]
|
266
273
|
|
267
|
-
records = find(records) if records.any? { |record| record.kind_of?(
|
274
|
+
records = find(records) if records.any? { |record| record.kind_of?(Integer) || record.kind_of?(String) }
|
268
275
|
delete_or_destroy(records, dependent)
|
269
276
|
end
|
270
277
|
|
@@ -275,7 +282,7 @@ module ActiveRecord
|
|
275
282
|
# +:dependent+ option.
|
276
283
|
def destroy(*records)
|
277
284
|
return if records.empty?
|
278
|
-
records = find(records) if records.any? { |record| record.kind_of?(
|
285
|
+
records = find(records) if records.any? { |record| record.kind_of?(Integer) || record.kind_of?(String) }
|
279
286
|
delete_or_destroy(records, :destroy)
|
280
287
|
end
|
281
288
|
|
@@ -562,7 +562,7 @@ module ActiveRecord
|
|
562
562
|
# Pet.find(1)
|
563
563
|
# # => ActiveRecord::RecordNotFound: Couldn't find Pet with id=1
|
564
564
|
#
|
565
|
-
# You can pass +
|
565
|
+
# You can pass +Integer+ or +String+ values, it finds the records
|
566
566
|
# responding to the +id+ and executes delete on them.
|
567
567
|
#
|
568
568
|
# class Person < ActiveRecord::Base
|
@@ -626,7 +626,7 @@ module ActiveRecord
|
|
626
626
|
#
|
627
627
|
# Pet.find(1, 2, 3) # => ActiveRecord::RecordNotFound: Couldn't find all Pets with IDs (1, 2, 3)
|
628
628
|
#
|
629
|
-
# You can pass +
|
629
|
+
# You can pass +Integer+ or +String+ values, it finds the records
|
630
630
|
# responding to the +id+ and then deletes them from the database.
|
631
631
|
#
|
632
632
|
# person.pets.size # => 3
|
@@ -52,7 +52,15 @@ module ActiveRecord
|
|
52
52
|
end
|
53
53
|
scope_chain_index += 1
|
54
54
|
|
55
|
-
|
55
|
+
klass_scope =
|
56
|
+
if klass.current_scope
|
57
|
+
klass.current_scope.clone.tap { |scope|
|
58
|
+
scope.joins_values = []
|
59
|
+
}
|
60
|
+
else
|
61
|
+
klass.send(:build_default_scope, ActiveRecord::Relation.create(klass, table))
|
62
|
+
end
|
63
|
+
scope_chain_items.concat [klass_scope].compact
|
56
64
|
|
57
65
|
rel = scope_chain_items.inject(scope_chain_items.shift) do |left, right|
|
58
66
|
left.merge right
|
@@ -69,7 +69,7 @@ module ActiveRecord
|
|
69
69
|
# by calling new on the column type or aggregation type (through composed_of) object with these parameters.
|
70
70
|
# So having the pairs written_on(1) = "2004", written_on(2) = "6", written_on(3) = "24", will instantiate
|
71
71
|
# written_on (a date type) with Date.new("2004", "6", "24"). You can also specify a typecast character in the
|
72
|
-
# parentheses to have the parameters typecasted before they're used in the constructor. Use i for
|
72
|
+
# parentheses to have the parameters typecasted before they're used in the constructor. Use i for Integer and
|
73
73
|
# f for Float. If all the values for a given attribute are empty, the attribute will be set to +nil+.
|
74
74
|
def assign_multiparameter_attributes(pairs)
|
75
75
|
execute_callstack_for_multiparameter_attributes(
|
@@ -50,7 +50,7 @@ module ActiveRecord
|
|
50
50
|
end
|
51
51
|
|
52
52
|
# Updates the attribute identified by <tt>attr_name</tt> with the
|
53
|
-
# specified +value+. Empty strings for
|
53
|
+
# specified +value+. Empty strings for Integer and Float columns are
|
54
54
|
# turned into +nil+.
|
55
55
|
def write_attribute(attr_name, value)
|
56
56
|
write_attribute_with_type_cast(attr_name, value, true)
|
@@ -637,7 +637,7 @@ module ActiveRecord
|
|
637
637
|
end
|
638
638
|
|
639
639
|
def pool_from_any_process_for(owner)
|
640
|
-
owner_to_pool = @owner_to_pool.values.find { |v| v[owner.name] }
|
640
|
+
owner_to_pool = @owner_to_pool.values.reverse.find { |v| v[owner.name] }
|
641
641
|
owner_to_pool && owner_to_pool[owner.name]
|
642
642
|
end
|
643
643
|
end
|
@@ -750,7 +750,7 @@ module ActiveRecord
|
|
750
750
|
case length
|
751
751
|
when Hash
|
752
752
|
column_names.each {|name| option_strings[name] += "(#{length[name]})" if length.has_key?(name) && length[name].present?}
|
753
|
-
when
|
753
|
+
when Integer
|
754
754
|
column_names.each {|name| option_strings[name] += "(#{length})"}
|
755
755
|
end
|
756
756
|
end
|
@@ -864,7 +864,7 @@ module ActiveRecord
|
|
864
864
|
|
865
865
|
# Increase timeout so the server doesn't disconnect us.
|
866
866
|
wait_timeout = @config[:wait_timeout]
|
867
|
-
wait_timeout = 2147483 unless wait_timeout.is_a?(
|
867
|
+
wait_timeout = 2147483 unless wait_timeout.is_a?(Integer)
|
868
868
|
variables['wait_timeout'] = self.class.type_cast_config_to_integer(wait_timeout)
|
869
869
|
|
870
870
|
# Make MySQL reject illegal values rather than truncating or blanking them, see
|
@@ -87,7 +87,6 @@ module ActiveRecord
|
|
87
87
|
#++
|
88
88
|
|
89
89
|
def active?
|
90
|
-
return false unless @connection
|
91
90
|
@connection.ping
|
92
91
|
end
|
93
92
|
|
@@ -102,10 +101,7 @@ module ActiveRecord
|
|
102
101
|
# Otherwise, this method does nothing.
|
103
102
|
def disconnect!
|
104
103
|
super
|
105
|
-
|
106
|
-
@connection.close
|
107
|
-
@connection = nil
|
108
|
-
end
|
104
|
+
@connection.close
|
109
105
|
end
|
110
106
|
|
111
107
|
#--
|
@@ -222,11 +218,9 @@ module ActiveRecord
|
|
222
218
|
|
223
219
|
# Executes the SQL statement in the context of this connection.
|
224
220
|
def execute(sql, name = nil)
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
@connection.query_options[:database_timezone] = ActiveRecord::Base.default_timezone
|
229
|
-
end
|
221
|
+
# make sure we carry over any changes to ActiveRecord::Base.default_timezone that have been
|
222
|
+
# made since we established the connection
|
223
|
+
@connection.query_options[:database_timezone] = ActiveRecord::Base.default_timezone
|
230
224
|
|
231
225
|
super
|
232
226
|
end
|
@@ -247,7 +247,7 @@ module ActiveRecord
|
|
247
247
|
# Returns a hash where the keys are column names and the values are
|
248
248
|
# default values when instantiating the AR object for this table.
|
249
249
|
def column_defaults
|
250
|
-
_default_attributes.to_hash
|
250
|
+
_default_attributes.dup.to_hash
|
251
251
|
end
|
252
252
|
|
253
253
|
def _default_attributes # :nodoc:
|
@@ -94,7 +94,7 @@ module ActiveRecord
|
|
94
94
|
#
|
95
95
|
# There are two basic forms of output:
|
96
96
|
#
|
97
|
-
# * Single aggregate value: The single value is type cast to
|
97
|
+
# * Single aggregate value: The single value is type cast to Integer for COUNT, Float
|
98
98
|
# for AVG, and the given column's type for everything else.
|
99
99
|
#
|
100
100
|
# * Grouped values: This returns an ordered hash of the values and groups them. It
|
@@ -34,10 +34,7 @@ module ActiveRecord
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def drop_table
|
37
|
-
if table_exists?
|
38
|
-
connection.remove_index table_name, name: index_name
|
39
|
-
connection.drop_table(table_name)
|
40
|
-
end
|
37
|
+
connection.drop_table table_name if table_exists?
|
41
38
|
end
|
42
39
|
|
43
40
|
def normalize_migration_number(number)
|
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: 4.2.
|
4
|
+
version: 4.2.8.rc1
|
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:
|
11
|
+
date: 2017-02-10 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: 4.2.
|
19
|
+
version: 4.2.8.rc1
|
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: 4.2.
|
26
|
+
version: 4.2.8.rc1
|
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: 4.2.
|
33
|
+
version: 4.2.8.rc1
|
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: 4.2.
|
40
|
+
version: 4.2.8.rc1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: arel
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -299,14 +299,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
299
299
|
version: 1.9.3
|
300
300
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
301
301
|
requirements:
|
302
|
-
- - "
|
302
|
+
- - ">"
|
303
303
|
- !ruby/object:Gem::Version
|
304
|
-
version:
|
304
|
+
version: 1.3.1
|
305
305
|
requirements: []
|
306
306
|
rubyforge_project:
|
307
|
-
rubygems_version: 2.6.
|
307
|
+
rubygems_version: 2.6.10
|
308
308
|
signing_key:
|
309
309
|
specification_version: 4
|
310
310
|
summary: Object-relational mapper framework (part of Rails).
|
311
311
|
test_files: []
|
312
|
-
has_rdoc:
|