activerecord 4.1.0.beta2 → 4.1.0.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.

Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +622 -9
  3. data/MIT-LICENSE +1 -1
  4. data/lib/active_record.rb +1 -1
  5. data/lib/active_record/associations.rb +10 -7
  6. data/lib/active_record/associations/alias_tracker.rb +39 -29
  7. data/lib/active_record/associations/association.rb +1 -1
  8. data/lib/active_record/associations/association_scope.rb +56 -31
  9. data/lib/active_record/associations/belongs_to_polymorphic_association.rb +5 -0
  10. data/lib/active_record/associations/builder/association.rb +6 -0
  11. data/lib/active_record/associations/builder/belongs_to.rb +1 -1
  12. data/lib/active_record/associations/collection_association.rb +33 -9
  13. data/lib/active_record/associations/collection_proxy.rb +53 -5
  14. data/lib/active_record/associations/has_many_association.rb +1 -1
  15. data/lib/active_record/associations/join_dependency.rb +5 -5
  16. data/lib/active_record/associations/join_dependency/join_association.rb +8 -8
  17. data/lib/active_record/associations/preloader.rb +1 -1
  18. data/lib/active_record/associations/singular_association.rb +1 -1
  19. data/lib/active_record/attribute_methods.rb +28 -5
  20. data/lib/active_record/attribute_methods/dirty.rb +27 -4
  21. data/lib/active_record/attribute_methods/read.rb +1 -1
  22. data/lib/active_record/attribute_methods/serialization.rb +18 -0
  23. data/lib/active_record/autosave_association.rb +1 -1
  24. data/lib/active_record/base.rb +1 -1
  25. data/lib/active_record/connection_adapters/abstract/connection_pool.rb +2 -2
  26. data/lib/active_record/connection_adapters/abstract/database_statements.rb +16 -9
  27. data/lib/active_record/connection_adapters/abstract/quoting.rb +3 -1
  28. data/lib/active_record/connection_adapters/abstract/schema_statements.rb +8 -8
  29. data/lib/active_record/connection_adapters/abstract/transaction.rb +4 -0
  30. data/lib/active_record/connection_adapters/abstract_adapter.rb +15 -5
  31. data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +2 -6
  32. data/lib/active_record/connection_adapters/connection_specification.rb +200 -43
  33. data/lib/active_record/connection_adapters/mysql2_adapter.rb +7 -1
  34. data/lib/active_record/connection_adapters/mysql_adapter.rb +8 -2
  35. data/lib/active_record/connection_adapters/postgresql/array_parser.rb +3 -2
  36. data/lib/active_record/connection_adapters/postgresql/cast.rb +7 -7
  37. data/lib/active_record/connection_adapters/postgresql/database_statements.rb +2 -2
  38. data/lib/active_record/connection_adapters/postgresql/quoting.rb +1 -1
  39. data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +13 -0
  40. data/lib/active_record/connection_adapters/postgresql_adapter.rb +32 -17
  41. data/lib/active_record/connection_adapters/sqlite3_adapter.rb +25 -3
  42. data/lib/active_record/connection_handling.rb +64 -3
  43. data/lib/active_record/core.rb +28 -24
  44. data/lib/active_record/dynamic_matchers.rb +6 -2
  45. data/lib/active_record/enum.rb +111 -17
  46. data/lib/active_record/errors.rb +12 -0
  47. data/lib/active_record/fixtures.rb +13 -15
  48. data/lib/active_record/inheritance.rb +29 -9
  49. data/lib/active_record/integration.rb +4 -2
  50. data/lib/active_record/migration.rb +20 -7
  51. data/lib/active_record/migration/command_recorder.rb +18 -6
  52. data/lib/active_record/persistence.rb +10 -5
  53. data/lib/active_record/querying.rb +1 -0
  54. data/lib/active_record/railtie.rb +11 -8
  55. data/lib/active_record/railties/databases.rake +24 -38
  56. data/lib/active_record/relation.rb +3 -2
  57. data/lib/active_record/relation/batches.rb +24 -9
  58. data/lib/active_record/relation/finder_methods.rb +100 -11
  59. data/lib/active_record/relation/query_methods.rb +39 -27
  60. data/lib/active_record/result.rb +1 -1
  61. data/lib/active_record/sanitization.rb +7 -5
  62. data/lib/active_record/scoping.rb +5 -0
  63. data/lib/active_record/scoping/named.rb +6 -0
  64. data/lib/active_record/store.rb +1 -1
  65. data/lib/active_record/tasks/database_tasks.rb +45 -23
  66. data/lib/active_record/timestamp.rb +2 -2
  67. data/lib/active_record/transactions.rb +7 -7
  68. data/lib/active_record/validations/presence.rb +1 -1
  69. data/lib/active_record/version.rb +1 -1
  70. metadata +5 -6
  71. data/lib/active_record/associations/join_helper.rb +0 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 93b5597ffd63ba0a54e42252678f44d1081cdfd9
4
- data.tar.gz: 3edb05e2df739c238a64321362241f7b2721ad07
3
+ metadata.gz: 405354ad128c731c25584b828b4acda425ef2dab
4
+ data.tar.gz: 8e315f5f0896a2ce6a64ef9465fedd8abea65d71
5
5
  SHA512:
6
- metadata.gz: 69f87e042603602b8bcdf18bee381d7bef2b80b2db18930620f450e57df98a01d7b4c26ef94a0e6923466f589024f2f2a9a8a1ea2eec194caf6fb46804974805
7
- data.tar.gz: 65c4c0941f44ab6ff1d9cb21b2b612a3b89a258afd1e288bb519880bdfce011a3f481f903537dc8141c5c7e776ecc889e9a485d9dceabc31b2cb1272fd426d8e
6
+ metadata.gz: afa67183ebc8ab7a002a7617aff44342ac742782c6c7e18025ba2c099d2e822d29bb89b42007d00f94cb697583b07b287778fbb6dc3b582e678015a6603b7c96
7
+ data.tar.gz: 32fd0026bdc183350d0803057c2b6794530d16ed4d764ec938aaeb52b37139083988216ae6d3a23a73fb3e8bb5243169efaf8d42b866c253fdf09965d1f0420d
@@ -1,3 +1,614 @@
1
+ * Default scopes are no longer overriden by chained conditions.
2
+
3
+ Before this change when you defined a `default_scope` in a model
4
+ it was overriden by chained conditions in the same field. Now it
5
+ is merged like any other scope.
6
+
7
+ Before:
8
+
9
+ class User < ActiveRecord::Base
10
+ default_scope { where state: 'pending' }
11
+ scope :active, -> { where state: 'active' }
12
+ scope :inactive, -> { where state: 'inactive' }
13
+ end
14
+
15
+ User.all
16
+ # SELECT "users".* FROM "users" WHERE "users"."state" = 'pending'
17
+
18
+ User.active
19
+ # SELECT "users".* FROM "users" WHERE "users"."state" = 'active'
20
+
21
+ User.where(state: 'inactive')
22
+ # SELECT "users".* FROM "users" WHERE "users"."state" = 'inactive'
23
+
24
+ After:
25
+
26
+ class User < ActiveRecord::Base
27
+ default_scope { where state: 'pending' }
28
+ scope :active, -> { where state: 'active' }
29
+ scope :inactive, -> { where state: 'inactive' }
30
+ end
31
+
32
+ User.all
33
+ # SELECT "users".* FROM "users" WHERE "users"."state" = 'pending'
34
+
35
+ User.active
36
+ # SELECT "users".* FROM "users" WHERE "users"."state" = 'pending' AND "users"."state" = 'active'
37
+
38
+ User.where(state: 'inactive')
39
+ # SELECT "users".* FROM "users" WHERE "users"."state" = 'pending' AND "users"."state" = 'inactive'
40
+
41
+ To get the previous behavior it is needed to explicitly remove the
42
+ `default_scope` condition using `unscoped`, `unscope`, `rewhere` or
43
+ `except`.
44
+
45
+ Example:
46
+
47
+ class User < ActiveRecord::Base
48
+ default_scope { where state: 'pending' }
49
+ scope :active, -> { unescope(where: :state).where(state: 'active') }
50
+ scope :inactive, -> { rewhere state: 'inactive' }
51
+ end
52
+
53
+ User.all
54
+ # SELECT "users".* FROM "users" WHERE "users"."state" = 'pending'
55
+
56
+ User.active
57
+ # SELECT "users".* FROM "users" WHERE "users"."state" = 'active'
58
+
59
+ User.inactive
60
+ # SELECT "users".* FROM "users" WHERE "users"."state" = 'inactive'
61
+
62
+ * Perform necessary deeper encoding when hstore is inside an array.
63
+
64
+ Fixes #11135.
65
+
66
+ *Josh Goodall*, *Genadi Samokovarov*
67
+
68
+ * Properly detect if a connection is still active before using it
69
+ in multi-threaded environments.
70
+
71
+ Fixes #12867.
72
+
73
+ *Kevin Casey*, *Matthew Draper*, *William (B.J.) Snow Orvis*
74
+
75
+ * When inverting add_index use the index name if present instead of
76
+ the columns.
77
+
78
+ If there are two indices with matching columns and one of them is
79
+ explicitly named then reverting the migration adding the named one
80
+ would instead drop the unnamed one.
81
+
82
+ The inversion of add_index will now drop the index by its name if
83
+ it is present.
84
+
85
+ *Hubert Dąbrowski*
86
+
87
+ * Add flag to disable schema dump after migration.
88
+
89
+ Add a config parameter on Active Record named `dump_schema_after_migration`
90
+ which is true by default. Now schema dump does not happen at the
91
+ end of migration rake task if `dump_schema_after_migration` is false.
92
+
93
+ *Emil Soman*
94
+
95
+ * `find_in_batches`, `find_each`, `Result#each` and `Enumerable#index_by` now
96
+ return an `Enumerator` that can calculate its size.
97
+
98
+ See also #13938.
99
+
100
+ *Marc-André Lafortune*
101
+
102
+ * Make sure transaction state gets reset after a commit operation on the record.
103
+
104
+ If a new transaction was open inside a callback, the record was loosing track
105
+ of the transaction level state, and it was leaking that state.
106
+
107
+ Fixes #12566.
108
+
109
+ *arthurnn*
110
+
111
+ * Pass `has_and_belongs_to_many` `:autosave` option to
112
+ the underlying `has_many :through` association.
113
+
114
+ Fixes #13923.
115
+
116
+ *Yves Senn*
117
+
118
+ * PostgreSQL implementation of `SchemaStatements#index_name_exists?`.
119
+
120
+ The database agnostic implementation does not detect with indexes that are
121
+ not supported by the ActiveRecord schema dumper. For example, expressions
122
+ indexes would not be detected.
123
+
124
+ Fixes #11018.
125
+
126
+ *Jonathan Baudanza*
127
+
128
+ * Parsing PostgreSQL arrays with empty strings now works correctly.
129
+
130
+ Previously, if you tried to parse `{"1","","2","","3"}` the result
131
+ would be `["1","2","3"]`, removing the empty strings from the array,
132
+ which would be incorrect. Now it will correctly produce `["1","","2","","3"]`
133
+ as the result of parsing the above PostgreSQL array.
134
+
135
+ Fixes #13907.
136
+
137
+ *Maurício Linhares*
138
+
139
+ * Associations now raise `ArgumentError` on name conflicts.
140
+
141
+ Dangerous association names conflicts include instance or class methods already
142
+ defined by `ActiveRecord::Base`.
143
+
144
+ Example:
145
+
146
+ class Car < ActiveRecord::Base
147
+ has_many :errors
148
+ end
149
+ # Will raise ArgumentError.
150
+
151
+ Fixes #13217.
152
+
153
+ *Lauro Caetano*
154
+
155
+ * Fix regressions on `select_*` methods.
156
+ When `select_*` methods receive a `Relation` object, they should be able to
157
+ get the arel/binds from it.
158
+ Also fix regressions on `select_rows` that was ignoring the binds.
159
+
160
+ Fixes #7538, #12017, #13731, #12056.
161
+
162
+ *arthurnn*
163
+
164
+ * Active Record objects can now be correctly dumped, loaded and dumped again
165
+ without issues.
166
+
167
+ Previously, if you did `YAML.dump`, `YAML.load` and then `YAML.dump` again
168
+ in an Active Record model that used serialization it would fail at the last
169
+ dump due to the fields not being correctly serialized before being dumped
170
+ to YAML. Now it is possible to dump and load the same object as many times
171
+ as needed without any issues.
172
+
173
+ Fixes #13861.
174
+
175
+ *Maurício Linhares*
176
+
177
+ * `find_in_batches` now returns an `Enumerator` when called without a block, so that it
178
+ can be chained with other `Enumerable` methods.
179
+
180
+ *Marc-André Lafortune*
181
+
182
+ * `enum` now raises on "dangerous" name conflicts.
183
+
184
+ Dangerous name conflicts includes instance or class method conflicts
185
+ with methods defined within `ActiveRecord::Base` but not its ancestors,
186
+ as well as conflicts with methods generated by other enums on the same
187
+ class.
188
+
189
+ Fixes #13389.
190
+
191
+ *Godfrey Chan*
192
+
193
+ * `scope` now raises on "dangerous" name conflicts.
194
+
195
+ Similar to dangerous attribute methods, a scope name conflict is
196
+ dangerous if it conflicts with an existing class method defined within
197
+ `ActiveRecord::Base` but not its ancestors.
198
+
199
+ See also #13389.
200
+
201
+ *Godfrey Chan*, *Philippe Creux*
202
+
203
+ * Correctly send an user provided statement to a `lock!()` call.
204
+
205
+ person.lock! 'FOR SHARE NOWAIT'
206
+ # Before: SELECT * ... LIMIT 1 FOR UPDATE
207
+ # After: SELECT * ... LIMIT 1 FOR SHARE NOWAIT
208
+
209
+ Fixes #13788.
210
+
211
+ *Maurício Linhares*
212
+
213
+ * Handle aliased attributes `select()`, `order()` and `reorder()`.
214
+
215
+ *Tsutomu Kuroda*
216
+
217
+ * Reset the collection association when calling `reset` on it.
218
+
219
+ Before:
220
+
221
+ post.comments.loaded? # => true
222
+ post.comments.reset
223
+ post.comments.loaded? # => true
224
+
225
+ After:
226
+
227
+ post.comments.loaded? # => true
228
+ post.comments.reset
229
+ post.comments.loaded? # => false
230
+
231
+ Fixes #13777.
232
+
233
+ *Kelsey Schlarman*
234
+
235
+ * Make enum fields work as expected with the `ActiveModel::Dirty` API.
236
+
237
+ Before this change, using the dirty API would have surprising results:
238
+
239
+ conversation = Conversation.new
240
+ conversation.status = :active
241
+ conversation.status = :archived
242
+ conversation.status_was # => 0
243
+
244
+ After this change, the same code would result in:
245
+
246
+ conversation = Conversation.new
247
+ conversation.status = :active
248
+ conversation.status = :archived
249
+ conversation.status_was # => "active"
250
+
251
+ *Rafael Mendonça França*
252
+
253
+ * `has_one` and `belongs_to` accessors don't add ORDER BY to the queries
254
+ anymore.
255
+
256
+ Since Rails 4.0, we add an ORDER BY in the `first` method to ensure
257
+ consistent results among different database engines. But for singular
258
+ associations this behavior is not needed since we will have one record to
259
+ return. As this ORDER BY option can lead some performance issues we are
260
+ removing it for singular associations accessors.
261
+
262
+ Fixes #12623.
263
+
264
+ *Rafael Mendonça França*
265
+
266
+ * Prepend table name for column names passed to `Relation#select`.
267
+
268
+ Example:
269
+
270
+ Post.select(:id)
271
+ # Before: => SELECT id FROM "posts"
272
+ # After: => SELECT "posts"."id" FROM "posts"
273
+
274
+ *Yves Senn*
275
+
276
+ * Fail early with "Primary key not included in the custom select clause"
277
+ in `find_in_batches`.
278
+
279
+ Before this patch, the exception was raised after the first batch was
280
+ yielded to the block. This means that you only get it, when you hit the
281
+ `batch_size` treshold. This could shadow the issue in development.
282
+
283
+ *Alexander Balashov*
284
+
285
+ * Ensure `second` through `fifth` methods act like the `first` finder.
286
+
287
+ The famous ordinal Array instance methods defined in ActiveSupport
288
+ (`first`, `second`, `third`, `fourth`, and `fifth`) are now available as
289
+ full-fledged finders in ActiveRecord. The biggest benefit of this is ordering
290
+ of the records returned now defaults to the table's primary key in ascending order.
291
+
292
+ Fixes #13743.
293
+
294
+ Example:
295
+
296
+ User.all.second
297
+
298
+ # Before
299
+ # => 'SELECT "users".* FROM "users"'
300
+
301
+ # After
302
+ # => SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1 OFFSET 1'
303
+
304
+ User.offset(3).second
305
+
306
+ # Before
307
+ # => 'SELECT "users".* FROM "users" LIMIT -1 OFFSET 3' # sqlite3 gem
308
+ # => 'SELECT "users".* FROM "users" OFFSET 3' # pg gem
309
+ # => 'SELECT `users`.* FROM `users` LIMIT 18446744073709551615 OFFSET 3' # mysql2 gem
310
+
311
+ # After
312
+ # => SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1 OFFSET 4'
313
+
314
+ *Jason Meller*
315
+
316
+ * ActiveRecord states are now correctly restored after a rollback for
317
+ models that did not define any transactional callbacks (i.e.
318
+ `after_commit`, `after_rollback` or `after_create`).
319
+
320
+ Fixes #13744.
321
+
322
+ *Godfrey Chan*
323
+
324
+ * Make `touch` fire the `after_commit` and `after_rollback` callbacks.
325
+
326
+ *Harry Brundage*
327
+
328
+ * Enable partial indexes for `sqlite >= 3.8.0`.
329
+
330
+ See http://www.sqlite.org/partialindex.html
331
+
332
+ *Cody Cutrer*
333
+
334
+ * Don't try to get the subclass if the inheritance column doesn't exist
335
+
336
+ The `subclass_from_attrs` method is called even if the column specified by
337
+ the `inheritance_column` setting doesn't exist. This prevents setting associations
338
+ via the attributes hash if the association name clashes with the value of the setting,
339
+ typically `:type`. This worked previously in Rails 3.2.
340
+
341
+ *Ujjwal Thaakar*
342
+
343
+ * Enum mappings are now exposed via class methods instead of constants.
344
+
345
+ Example:
346
+
347
+ class Conversation < ActiveRecord::Base
348
+ enum status: [ :active, :archived ]
349
+ end
350
+
351
+ Before:
352
+
353
+ Conversation::STATUS # => { "active" => 0, "archived" => 1 }
354
+
355
+ After:
356
+
357
+ Conversation.statuses # => { "active" => 0, "archived" => 1 }
358
+
359
+ *Godfrey Chan*
360
+
361
+ * Set `NameError#name` when STI-class-lookup fails.
362
+
363
+ *Chulki Lee*
364
+
365
+ * Fix bug in `becomes!` when changing from the base model to a STI sub-class.
366
+
367
+ Fixes #13272.
368
+
369
+ *the-web-dev*, *Yves Senn*
370
+
371
+ * Currently Active Record can be configured via the environment variable
372
+ `DATABASE_URL` or by manually injecting a hash of values which is what Rails does,
373
+ reading in `database.yml` and setting Active Record appropriately. Active Record
374
+ expects to be able to use `DATABASE_URL` without the use of Rails, and we cannot
375
+ rip out this functionality without deprecating. This presents a problem though
376
+ when both config is set, and a `DATABASE_URL` is present. Currently the
377
+ `DATABASE_URL` should "win" and none of the values in `database.yml` are
378
+ used. This is somewhat unexpected, if one were to set values such as
379
+ `pool` in the `production:` group of `database.yml` they are ignored.
380
+
381
+ There are many ways that Active Record initiates a connection today:
382
+
383
+ - Stand Alone (without rails)
384
+ - `rake db:<tasks>`
385
+ - `ActiveRecord.establish_connection`
386
+
387
+ - With Rails
388
+ - `rake db:<tasks>`
389
+ - `rails <server> | <console>`
390
+ - `rails dbconsole`
391
+
392
+ Now all of these behave exactly the same way. The best way to do
393
+ this is to put all of this logic in one place so it is guaranteed to be used.
394
+
395
+ Here is the matrix of how this behavior works:
396
+
397
+ ```
398
+ No database.yml
399
+ No DATABASE_URL
400
+ => Error
401
+ ```
402
+
403
+ ```
404
+ database.yml present
405
+ No DATABASE_URL
406
+ => Use database.yml configuration
407
+ ```
408
+
409
+ ```
410
+ No database.yml
411
+ DATABASE_URL present
412
+ => use DATABASE_URL configuration
413
+ ```
414
+
415
+ ```
416
+ database.yml present
417
+ DATABASE_URL present
418
+ => Merged into `url` sub key. If both specify `url` sub key, the `database.yml` `url`
419
+ sub key "wins". If other paramaters `adapter` or `database` are specified in YAML,
420
+ they are discarded as the `url` sub key "wins".
421
+ ```
422
+
423
+ Current implementation uses `ActiveRecord::Base.configurations` to resolve and merge
424
+ all connection information before returning. This is achieved through a utility
425
+ class: `ActiveRecord::ConnectionHandling::MergeAndResolveDefaultUrlConfig`.
426
+
427
+ To understand the exact behavior of this class, it is best to review the
428
+ behavior in `activerecord/test/cases/connection_adapters/connection_handler_test.rb`.
429
+
430
+ *Richard Schneeman*
431
+
432
+ * Make `change_column_null` revertable. Fixes #13576.
433
+
434
+ *Yves Senn*, *Nishant Modak*, *Prathamesh Sonpatki*
435
+
436
+ * Don't create/drop the test database if RAILS_ENV is specified explicitly.
437
+
438
+ Previously, when the environment was development, we would always
439
+ create or drop both the test and development databases.
440
+
441
+ Now, if RAILS_ENV is explicitly defined as development, we don't create
442
+ the test database.
443
+
444
+ *Damien Mathieu*
445
+
446
+ * Initialize version on Migration objects so that it can be used in a migration,
447
+ and it will be included in the announce message.
448
+
449
+ *Dylan Thacker-Smith*
450
+
451
+ * `change_table` now uses the current adapter's `update_table_definition`
452
+ method to retrieve a specific table definition.
453
+ This ensures that `change_table` and `create_table` will use
454
+ similar objects.
455
+
456
+ Fixes #13577, #13503.
457
+
458
+ *Nishant Modak*, *Prathamesh Sonpatki*, *Rafael Mendonça França*
459
+
460
+ * Fixed ActiveRecord::Store nil conversion TypeError when using YAML coder.
461
+ In case the YAML passed as paramter is nil, uses an empty string.
462
+
463
+ Fixes #13570.
464
+
465
+ *Thales Oliveira*
466
+
467
+ * Deprecate unused `ActiveRecord::Base.symbolized_base_class`
468
+ and `ActiveRecord::Base.symbolized_sti_name` without replacement.
469
+
470
+ *Yves Senn*
471
+
472
+ * Since the `test_help.rb` file in Railties now automatically maintains
473
+ your test schema, the `rake db:test:*` tasks are deprecated. This
474
+ doesn't stop you manually running other tasks on your test database
475
+ if needed:
476
+
477
+ rake db:schema:load RAILS_ENV=test
478
+
479
+ *Jon Leighton*
480
+
481
+ * Fix presence validator for association when the associated record responds to `to_a`.
482
+
483
+ *gmarik*
484
+
485
+ * Fixed regression on preload/includes with multiple arguments failing in certain conditions,
486
+ raising a NoMethodError internally by calling `reflect_on_association` for `NilClass:Class`.
487
+
488
+ Fixes #13437.
489
+
490
+ *Vipul A M*, *khustochka*
491
+
492
+ * Add the ability to nullify the `enum` column.
493
+
494
+ Example:
495
+
496
+ class Conversation < ActiveRecord::Base
497
+ enum gender: [:female, :male]
498
+ end
499
+
500
+ Conversation::GENDER # => { female: 0, male: 1 }
501
+
502
+ # conversation.update! gender: 0
503
+ conversation.female!
504
+ conversation.female? # => true
505
+ conversation.gender # => "female"
506
+
507
+ # conversation.update! gender: nil
508
+ conversation.gender = nil
509
+ conversation.gender.nil? # => true
510
+ conversation.gender # => nil
511
+
512
+ *Amr Tamimi*
513
+
514
+ * Connection specification now accepts a "url" key. The value of this
515
+ key is expected to contain a database URL. The database URL will be
516
+ expanded into a hash and merged.
517
+
518
+ *Richard Schneeman*
519
+
520
+ * An `ArgumentError` is now raised on a call to `Relation#where.not(nil)`.
521
+
522
+ Example:
523
+
524
+ User.where.not(nil)
525
+
526
+ # Before
527
+ # => 'SELECT `users`.* FROM `users` WHERE (NOT (NULL))'
528
+
529
+ # After
530
+ # => ArgumentError, 'Invalid argument for .where.not(), got nil.'
531
+
532
+ *Kuldeep Aggarwal*
533
+
534
+ * Deprecated use of string argument as a configuration lookup in
535
+ `ActiveRecord::Base.establish_connection`. Instead, a symbol must be given.
536
+
537
+ *José Valim*
538
+
539
+ * Fixed `update_column`, `update_columns`, and `update_all` to correctly serialize
540
+ values for `array`, `hstore` and `json` column types in PostgreSQL.
541
+
542
+ Fixes #12261.
543
+
544
+ *Tadas Tamosauskas*, *Carlos Antonio da Silva*
545
+
546
+ * Do not consider PostgreSQL array columns as number or text columns.
547
+
548
+ The code uses these checks in several places to know what to do with a
549
+ particular column, for instance AR attribute query methods has a branch
550
+ like this:
551
+
552
+ if column.number?
553
+ !value.zero?
554
+ end
555
+
556
+ This should never be true for array columns, since it would be the same
557
+ as running [].zero?, which results in a NoMethodError exception.
558
+
559
+ Fixing this by ensuring that array columns in PostgreSQL never return
560
+ true for number?/text? checks.
561
+
562
+ *Carlos Antonio da Silva*
563
+
564
+ * When connecting to a non-existant database, the error:
565
+ `ActiveRecord::NoDatabaseError` will now be raised. When being used with Rails
566
+ the error message will include information on how to create a database:
567
+ `rake db:create`. Supported adapters: postgresql, mysql, mysql2, sqlite3
568
+
569
+ *Richard Schneeman*
570
+
571
+ * Do not raise `'cannot touch on a new record object'` exception on destroying
572
+ already destroyed `belongs_to` association with `touch: true` option.
573
+
574
+ Fixes #13445.
575
+
576
+ Example:
577
+
578
+ # Given Comment has belongs_to :post, touch: true
579
+ comment.post.destroy
580
+ comment.destroy # no longer raises an error
581
+
582
+ *Paul Nikitochkin*
583
+
584
+ * Fix a bug when assigning an array containing string numbers to a
585
+ PostgreSQL integer array column.
586
+
587
+ Fixes #13444.
588
+
589
+ Example:
590
+
591
+ # Given Book#ratings is of type :integer, array: true
592
+ Book.new(ratings: [1, 2]) # worked before
593
+ Book.new(ratings: ['1', '2']) # now works as well
594
+
595
+ *Damien Mathieu*
596
+
597
+ * Fix `PostgreSQL` insert to properly extract table name from multiline string SQL.
598
+
599
+ Previously, executing an insert SQL in `PostgreSQL` with a command like this:
600
+
601
+ insert into articles(
602
+ number)
603
+ values(
604
+ 5152
605
+ )
606
+
607
+ would not work because the adapter was unable to extract the correct `articles`
608
+ table name.
609
+
610
+ *Kuldeep Aggarwal*
611
+
1
612
  * Correctly escape PostgreSQL arrays.
2
613
 
3
614
  Fixes: CVE-2014-0080
@@ -148,7 +759,7 @@
148
759
  *kostya*, *Lauro Caetano*
149
760
 
150
761
  * `type_to_sql` returns a `String` for unmapped columns. This fixes an error
151
- when using unmapped array types in PG
762
+ when using unmapped PostgreSQL array types.
152
763
 
153
764
  Example:
154
765
 
@@ -187,7 +798,7 @@
187
798
 
188
799
  * Update counter cache on a `has_many` relationship regardless of default scope.
189
800
 
190
- Fix #12952.
801
+ Fixes #12952.
191
802
 
192
803
  *Uku Taht*
193
804
 
@@ -198,9 +809,10 @@
198
809
 
199
810
  *Cody Cutrer*, *Yves Senn*
200
811
 
201
- * Raise `ActiveRecord::RecordNotDestroyed` when a replaced child marked with `dependent: destroy` fails to be destroyed.
812
+ * Raise `ActiveRecord::RecordNotDestroyed` when a replaced child
813
+ marked with `dependent: destroy` fails to be destroyed.
202
814
 
203
- Fix #12812
815
+ Fixes #12812.
204
816
 
205
817
  *Brian Thomas Storti*
206
818
 
@@ -374,7 +986,7 @@
374
986
 
375
987
  *Severin Schoepke*
376
988
 
377
- * `ActiveRecord::Store` works together with PG `hstore` columns.
989
+ * `ActiveRecord::Store` works together with PostgreSQL `hstore` columns.
378
990
 
379
991
  Fixes #12452.
380
992
 
@@ -660,7 +1272,7 @@
660
1272
 
661
1273
  *Yves Senn* , *Severin Schoepke*
662
1274
 
663
- * Fix multidimensional PG arrays containing non-string items.
1275
+ * Fix multidimensional PostgreSQL arrays containing non-string items.
664
1276
 
665
1277
  *Yves Senn*
666
1278
 
@@ -678,7 +1290,7 @@
678
1290
 
679
1291
  *Richard Schneeman*
680
1292
 
681
- * Removed redundant override of `xml` column definition for PG,
1293
+ * Removed redundant override of `xml` column definition for PostgreSQL,
682
1294
  in order to use `xml` column type instead of `text`.
683
1295
 
684
1296
  *Paul Nikitochkin*, *Michael Nikitochkin*
@@ -1089,7 +1701,7 @@
1089
1701
 
1090
1702
  *John Wang*
1091
1703
 
1092
- * Fix `add_column` with `array` option when using PostgreSQL. Fixes #10432
1704
+ * Fix `add_column` with `array` option when using PostgreSQL. Fixes #10432.
1093
1705
 
1094
1706
  *Adam Anderson*
1095
1707
 
@@ -1106,6 +1718,7 @@
1106
1718
  *Yves Senn*
1107
1719
 
1108
1720
  * Fix the `:primary_key` option for `has_many` associations.
1721
+
1109
1722
  Fixes #10693.
1110
1723
 
1111
1724
  *Yves Senn*
@@ -1230,7 +1843,7 @@
1230
1843
 
1231
1844
  * Trigger a save on `has_one association=(associate)` when the associate contents have changed.
1232
1845
 
1233
- Fix #8856.
1846
+ Fixes #8856.
1234
1847
 
1235
1848
  *Chris Thompson*
1236
1849