activerecord 4.2.6 → 4.2.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7c2b204ada8e1df91ea2aceec0e853f5e99c030
4
- data.tar.gz: d93ed764a8fa7a298bb265953f1577bd73a7e247
3
+ metadata.gz: 810edcdd86b95f13aa4149b97f7c704108e88e0f
4
+ data.tar.gz: 0969cd104a5bf6669ac2936d8d7e1e782cbdabb1
5
5
  SHA512:
6
- metadata.gz: 5515c0c52dcc765b5f81553db0079c98805c9051b8472b789fdb94356cf1684e5b96de227850e3d7d21f35d0fb1baf5e769c1d81932cdd998fffae97ea1db1dd
7
- data.tar.gz: 5ba2cfdd03d5c524aca5e9a9239f2131e3a670d1b414184905c944a6d72a9a3ad45b3506f58e4eadb1f7d0702e2429eb2176f5f7ac352f70dc867985a97a38f7
6
+ metadata.gz: c0c365732399dbc6e93632ac9c338638cb3aadb677e77fe99febc2037f766caa8a3e57881b84baaccbb1e0196c85d5706b13ea5545c1d676c8983d1ab8c33d66
7
+ data.tar.gz: c1ceddc6f5ef9a731263e195814bccb652fac236a6323af1bedf9e092ca17e08a6c7a18b85f5f68413389d0aabb128aa7b590c9b404aae79f1936a76a9ed3db7
@@ -1,3 +1,38 @@
1
+ ## Rails 4.2.7.rc1 (June 30, 2016) ##
2
+
3
+ * Inspecting an object with an associated array of over 10 elements no longer
4
+ truncates the array, preventing `inspect` from looping infinitely in some
5
+ cases.
6
+
7
+ *Kevin McPhillips*
8
+
9
+ * Ensure hashes can be assigned to attributes created using `composed_of`.
10
+ Fixes #25210.
11
+
12
+ *Sean Griffin*
13
+
14
+ * Queries such as `Computer.joins(:monitor).group(:status).count` will now be
15
+ interpreted as `Computer.joins(:monitor).group('computers.status').count`
16
+ so that when `Computer` and `Monitor` have both `status` columns we don't
17
+ have conflicts in projection.
18
+
19
+ *Rafael Sales*
20
+
21
+ * ActiveRecord::Relation#count: raise an ArgumentError when finder options
22
+ are specified or an ActiveRecord::StatementInvalid when an invalid type
23
+ is provided for a column name (e.g. a Hash).
24
+
25
+ Fixes #20434
26
+
27
+ *Konstantinos Rousis*
28
+
29
+ * Correctly pass MySQL options when using structure_dump or structure_load
30
+
31
+ Specifically, it fixes an issue when using SSL authentication.
32
+
33
+ *Alex Coomans*
34
+
35
+
1
36
  ## Rails 4.2.6 (March 07, 2016) ##
2
37
 
3
38
  * Fix a bug where using `t.foreign_key` twice with the same `to_table` within
@@ -244,14 +244,15 @@ module ActiveRecord
244
244
  def writer_method(name, class_name, mapping, allow_nil, converter)
245
245
  define_method("#{name}=") do |part|
246
246
  klass = class_name.constantize
247
- if part.is_a?(Hash)
248
- part = klass.new(*part.values)
249
- end
250
247
 
251
248
  unless part.is_a?(klass) || converter.nil? || part.nil?
252
249
  part = converter.respond_to?(:call) ? converter.call(part) : klass.send(converter, part)
253
250
  end
254
251
 
252
+ if part.is_a?(Hash)
253
+ part = klass.new(*part.values)
254
+ end
255
+
255
256
  if part.nil? && allow_nil
256
257
  mapping.each { |key, _| self[key] = nil }
257
258
  @aggregation_cache[name] = nil
@@ -287,9 +287,8 @@ module ActiveRecord
287
287
  # Returns an <tt>#inspect</tt>-like string for the value of the
288
288
  # attribute +attr_name+. String attributes are truncated up to 50
289
289
  # characters, Date and Time attributes are returned in the
290
- # <tt>:db</tt> format, Array attributes are truncated up to 10 values.
291
- # Other attributes return the value of <tt>#inspect</tt> without
292
- # modification.
290
+ # <tt>:db</tt> format. Other attributes return the value of
291
+ # <tt>#inspect</tt> without modification.
293
292
  #
294
293
  # person = Person.create!(name: 'David Heinemeier Hansson ' * 3)
295
294
  #
@@ -300,7 +299,7 @@ module ActiveRecord
300
299
  # # => "\"2012-10-22 00:15:07\""
301
300
  #
302
301
  # person.attribute_for_inspect(:tag_ids)
303
- # # => "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...]"
302
+ # # => "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]"
304
303
  def attribute_for_inspect(attr_name)
305
304
  value = read_attribute(attr_name)
306
305
 
@@ -308,9 +307,6 @@ module ActiveRecord
308
307
  "#{value[0, 50]}...".inspect
309
308
  elsif value.is_a?(Date) || value.is_a?(Time)
310
309
  %("#{value.to_s(:db)}")
311
- elsif value.is_a?(Array) && value.size > 10
312
- inspected = value.first(10).inspect
313
- %(#{inspected[0...-1]}, ...])
314
310
  else
315
311
  value.inspect
316
312
  end
@@ -111,6 +111,18 @@ module ActiveRecord
111
111
  @prepared_statements = false
112
112
  end
113
113
 
114
+ class Version
115
+ include Comparable
116
+
117
+ def initialize(version_string)
118
+ @version = version_string.split('.').map(&:to_i)
119
+ end
120
+
121
+ def <=>(version_string)
122
+ @version <=> version_string.split('.').map(&:to_i)
123
+ end
124
+ end
125
+
114
126
  class BindCollector < Arel::Collectors::Bind
115
127
  def compile(bvs, conn)
116
128
  super(bvs.map { |bv| conn.quote(*bv.reverse) })
@@ -203,7 +203,7 @@ module ActiveRecord
203
203
  #
204
204
  # http://bugs.mysql.com/bug.php?id=39170
205
205
  def supports_transaction_isolation?
206
- version[0] >= 5
206
+ version >= '5.0.0'
207
207
  end
208
208
 
209
209
  def supports_indexes_in_create?
@@ -215,7 +215,11 @@ module ActiveRecord
215
215
  end
216
216
 
217
217
  def supports_views?
218
- version[0] >= 5
218
+ version >= '5.0.0'
219
+ end
220
+
221
+ def supports_datetime_with_precision?
222
+ version >= '5.6.4'
219
223
  end
220
224
 
221
225
  def native_database_types
@@ -840,7 +844,7 @@ module ActiveRecord
840
844
  private
841
845
 
842
846
  def version
843
- @version ||= full_version.scan(/^(\d+)\.(\d+)\.(\d+)/).flatten.map { |v| v.to_i }
847
+ @version ||= Version.new(full_version.match(/^\d+\.\d+\.\d+/)[0])
844
848
  end
845
849
 
846
850
  def mariadb?
@@ -848,7 +852,7 @@ module ActiveRecord
848
852
  end
849
853
 
850
854
  def supports_rename_index?
851
- mariadb? ? false : (version[0] == 5 && version[1] >= 7) || version[0] >= 6
855
+ mariadb? ? false : version >= '5.7.6'
852
856
  end
853
857
 
854
858
  def configure_connection
@@ -75,7 +75,7 @@ module ActiveRecord
75
75
  end
76
76
 
77
77
  def quoted_date(value)
78
- if value.acts_like?(:time) && value.respond_to?(:usec)
78
+ if supports_datetime_with_precision? && value.acts_like?(:time) && value.respond_to?(:usec)
79
79
  "#{super}.#{sprintf("%06d", value.usec)}"
80
80
  else
81
81
  super
@@ -563,7 +563,7 @@ module ActiveRecord
563
563
  when 1, 2; 'smallint'
564
564
  when 3, 4; 'integer'
565
565
  when 5..8; 'bigint'
566
- else raise(ActiveRecordError, "No integer type has byte size #{limit}. Use a numeric with precision 0 instead.")
566
+ else raise(ActiveRecordError, "No integer type has byte size #{limit}. Use a numeric with scale 0 instead.")
567
567
  end
568
568
  when 'datetime'
569
569
  return super unless precision
@@ -74,18 +74,6 @@ module ActiveRecord
74
74
  boolean: { name: "boolean" }
75
75
  }
76
76
 
77
- class Version
78
- include Comparable
79
-
80
- def initialize(version_string)
81
- @version = version_string.split('.').map { |v| v.to_i }
82
- end
83
-
84
- def <=>(version_string)
85
- @version <=> version_string.split('.').map { |v| v.to_i }
86
- end
87
- end
88
-
89
77
  class StatementPool < ConnectionAdapters::StatementPool
90
78
  def initialize(connection, max)
91
79
  super
@@ -7,8 +7,8 @@ module ActiveRecord
7
7
  module VERSION
8
8
  MAJOR = 4
9
9
  MINOR = 2
10
- TINY = 6
11
- PRE = nil
10
+ TINY = 7
11
+ PRE = "rc1"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
@@ -36,9 +36,15 @@ module ActiveRecord
36
36
  # Note: not all valid +select+ expressions are valid +count+ expressions. The specifics differ
37
37
  # between databases. In invalid cases, an error from the database is thrown.
38
38
  def count(column_name = nil, options = {})
39
+ if options.present? && !ActiveRecord.const_defined?(:DeprecatedFinders)
40
+ raise ArgumentError, "Relation#count does not support finder options anymore. " \
41
+ "Please build a scope and then call count on it or use the " \
42
+ "activerecord-deprecated_finders gem to enable this functionality."
43
+
44
+ end
45
+
39
46
  # TODO: Remove options argument as soon we remove support to
40
47
  # activerecord-deprecated_finders.
41
- column_name, options = nil, column_name if column_name.is_a?(Hash)
42
48
  calculate(:count, column_name, options)
43
49
  end
44
50
 
@@ -281,6 +287,7 @@ module ActiveRecord
281
287
  else
282
288
  group_fields = group_attrs
283
289
  end
290
+ group_fields = arel_columns(group_fields)
284
291
 
285
292
  group_aliases = group_fields.map { |field|
286
293
  column_alias_for(field)
@@ -137,6 +137,7 @@ module ActiveRecord
137
137
  Migrator.migrate(migrations_paths, version) do |migration|
138
138
  scope.blank? || scope == migration.scope
139
139
  end
140
+ ActiveRecord::Base.clear_cache!
140
141
  ensure
141
142
  Migration.verbose = verbose_was
142
143
  end
@@ -129,15 +129,19 @@ IDENTIFIED BY '#{configuration['password']}' WITH GRANT OPTION;
129
129
  end
130
130
 
131
131
  def prepare_command_options
132
- args = []
133
- args.concat(['--user', configuration['username']]) if configuration['username']
134
- args << "--password=#{configuration['password']}" if configuration['password']
135
- args.concat(['--default-character-set', configuration['encoding']]) if configuration['encoding']
136
- configuration.slice('host', 'port', 'socket').each do |k, v|
137
- args.concat([ "--#{k}", v.to_s ]) if v
138
- end
139
-
140
- args
132
+ {
133
+ 'host' => '--host',
134
+ 'port' => '--port',
135
+ 'socket' => '--socket',
136
+ 'username' => '--user',
137
+ 'password' => '--password',
138
+ 'encoding' => '--default-character-set',
139
+ 'sslca' => '--ssl-ca',
140
+ 'sslcert' => '--ssl-cert',
141
+ 'sslcapath' => '--ssl-capath',
142
+ 'sslcipher' => '--ssl-cipher',
143
+ 'sslkey' => '--ssl-key'
144
+ }.map { |opt, arg| "#{arg}=#{configuration[opt]}" if configuration[opt] }.compact
141
145
  end
142
146
 
143
147
  def run_cmd(cmd, args, action)
@@ -9,6 +9,10 @@ module ActiveRecord
9
9
  ::Date
10
10
  end
11
11
 
12
+ def type_cast_for_database(value)
13
+ type_cast(value)
14
+ end
15
+
12
16
  def type_cast_for_schema(value)
13
17
  "'#{value.to_s(:db)}'"
14
18
  end
@@ -27,12 +27,12 @@ module ActiveRecord
27
27
  end
28
28
  end
29
29
 
30
- scale ? casted_value.round(scale) : casted_value
30
+ apply_scale(casted_value)
31
31
  end
32
32
 
33
33
  def convert_float_to_big_decimal(value)
34
34
  if precision
35
- BigDecimal(value, float_precision)
35
+ BigDecimal(apply_scale(value), float_precision)
36
36
  else
37
37
  value.to_d
38
38
  end
@@ -45,6 +45,14 @@ module ActiveRecord
45
45
  precision.to_i
46
46
  end
47
47
  end
48
+
49
+ def apply_scale(value)
50
+ if scale
51
+ value.round(scale)
52
+ else
53
+ value
54
+ end
55
+ end
48
56
  end
49
57
  end
50
58
  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: 4.2.6
4
+ version: 4.2.7.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: 2016-03-07 00:00:00.000000000 Z
11
+ date: 2016-07-01 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.6
19
+ version: 4.2.7.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.6
26
+ version: 4.2.7.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.6
33
+ version: 4.2.7.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.6
40
+ version: 4.2.7.rc1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: arel
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -299,12 +299,12 @@ 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: '0'
304
+ version: 1.3.1
305
305
  requirements: []
306
306
  rubyforge_project:
307
- rubygems_version: 2.5.1
307
+ rubygems_version: 2.6.6
308
308
  signing_key:
309
309
  specification_version: 4
310
310
  summary: Object-relational mapper framework (part of Rails).