File: CHANGELOG.md

package info (click to toggle)
rails 2%3A4.2.7.1-1%2Bdeb9u2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,416 kB
  • sloc: ruby: 186,673; yacc: 45; sql: 43; sh: 14; makefile: 12
file content (1953 lines) | stat: -rw-r--r-- 51,861 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
## Rails 4.2.7 (July 12, 2016) ##

*   Inspecting an object with an associated array of over 10 elements no longer
    truncates the array, preventing `inspect` from looping infinitely in some
    cases.

    *Kevin McPhillips*

*   Ensure hashes can be assigned to attributes created using `composed_of`.
    Fixes #25210.

    *Sean Griffin*

*   Queries such as `Computer.joins(:monitor).group(:status).count` will now be
    interpreted as  `Computer.joins(:monitor).group('computers.status').count`
    so that when `Computer` and `Monitor` have both `status` columns we don't
    have conflicts in projection.

    *Rafael Sales*

*   ActiveRecord::Relation#count: raise an ArgumentError when finder options
    are specified or an ActiveRecord::StatementInvalid when an invalid type
    is provided for a column name (e.g. a Hash).

    Fixes #20434

    *Konstantinos Rousis*

*   Correctly pass MySQL options when using structure_dump or structure_load

    Specifically, it fixes an issue when using SSL authentication.

    *Alex Coomans*


## Rails 4.2.6 (March 07, 2016) ##

*   Fix a bug where using `t.foreign_key` twice with the same `to_table` within
    the same table definition would only create one foreign key.

    *George Millo*

*   Fix regression in dirty attribute tracking after #dup.  Changes to the
    clone no longer show as changed attributes in the original object.

    *Dominic Cleal*

*   Fix regression when loading fixture files with symbol keys.

    Closes #22584.

    *Yves Senn*

*   Fix `rake db:structure:dump` on Postgres when multiple schemas are used.

    Fixes #22346.

    *Nick Muerdter*, *ckoenig*

*   Introduce `connection.data_sources` and `connection.data_source_exists?`.
    These methods determine what relations can be used to back Active Record
    models (usually tables and views).

    *Yves Senn*, *Matthew Draper*


## Rails 4.2.5.2 (February 26, 2016) ##

*   No changes.


## Rails 4.2.5.1 (January 25, 2015) ##

*   No changes.


## Rails 4.2.5 (November 12, 2015) ##

*   No longer pass deprecated option `-i` to `pg_dump`.

    *Paul Sadauskas*

*   Set `scope.reordering_value` to `true` if :reordering values are specified.

    Fixes #21886.

    *Hiroaki Izu*

*   Avoid disabling errors on the PostgreSQL connection when enabling the
    standard_conforming_strings setting. Errors were previously disabled because
    the setting wasn't writable in Postgres 8.1 and didn't exist in earlier
    versions. Now Rails only supports Postgres 8.2+ we're fine to assume the
    setting exists. Disabling errors caused problems when using a connection
    pooling tool like PgBouncer because it's not guaranteed to have the same
    connection between calls to `execute` and it could leave the connection
    with errors disabled.

    Fixes #22101.

    *Harry Marr*

*   Includes HABTM returns correct size now. It's caused by the join dependency
    only instantiates one HABTM object because the join table hasn't a primary key.

    Fixes #16032.

    Examples:

        before:

        Project.first.salaried_developers.size # => 3
        Project.includes(:salaried_developers).first.salaried_developers.size # => 1

        after:

        Project.first.salaried_developers.size # => 3
        Project.includes(:salaried_developers).first.salaried_developers.size # => 3

    *Bigxiang*

*   Descriptive error message when fixtures contain a missing column.

    Closes #21201.

    *Yves Senn*

*   `bin/rake db:migrate` uses
    `ActiveRecord::Tasks::DatabaseTasks.migrations_paths` instead of
    `Migrator.migrations_paths`.

    *Tobias Bielohlawek*

*   Fix `rewhere` in a `has_many` association.

    Fixes #21955.

    *Josh Branchaud*, *Kal*

*   Added run_cmd class method to ActiveRecord::Tasks::DatabaseTasks for
    drying up Kernel.system() calls within this namespace and to avoid
    shell expansion by using a paramter list instead of string as arguments
    for Kernel.system(). Thanks to Nate Berkopec for supply patch to get
    test units passing.

    *Bryan Paxton*

*   Avoid leaking the first relation we call `first` on, per model.

    Fixes #21921.

    *Matthew Draper*, *Jean Boussier*

*   Allow deserialization of Active Record models that were YAML encoded prior
    to Rails 4.2

    *Sean Griffin*

*   Correctly apply `unscope` when preloading through associations.

    *Jimmy Bourassa*

*   Ensure `select` quotes aliased attributes, even when using `from`.

    Fixes #21488

    *Sean Griffin & @johanlunds*

*   Correct query for PostgreSQL 8.2 compatibility.

    *Ben Murphy*, *Matthew Draper*

*   Uniqueness validator raises descriptive error when running on a persisted
    record without primary key.

    Closes #21304.

    *Yves Senn*


## Rails 4.2.4 (August 24, 2015) ##

*   Skip statement cache on through association reader.

    If the through class has default scopes we should skip the statement
    cache.

    Closes #20745.

    *Rafael Mendonça França*

*   Fixes #19420. When generating schema.rb using Postgres BigInt[] data type
    the limit: 8 was not coming through. This caused it to become Int[] data type
    after doing a rebuild off of schema.rb.

    *Jake Waller*

*   Fix state being carried over from previous transaction.

    Considering the following example where `name` is a required attribute.
    Before we had `new_record?` returning `true` for a persisted record:

        author = Author.create! name: 'foo'
        author.name = nil
        author.save        # => false
        author.new_record? # => true

    Fixes #20824.

    *Roque Pinel*

*   Correctly ignore `mark_for_destruction` when `autosave` isn't set to `true`
    when validating associations.

    Fixes #20882.

    *Sean Griffin*

*   Fix through associations using scopes having the scope merged multiple
    times.

    Fixes #20721.
    Fixes #20727.

    *Sean Griffin*

*   `ActiveRecord::Base.dump_schema_after_migration` applies migration tasks
    other than `db:migrate`. (eg. `db:rollback`, `db:migrate:dup`, ...)

    Fixes #20743.

    *Yves Senn*

*   Correctly raise `ActiveRecord::AssociationTypeMismatch` when assigning
    a wrong type to a namespaced association.

    Fixes #20545.

    *Diego Carrion*

*   Prevent error when using `force_reload: true` on an unassigned polymorphic
    belongs_to association.

    Fixes #20426.

    *James Dabbs*


## Rails 4.2.3 (June 25, 2015) ##

*   Let `WITH` queries (Common Table Expressions) be explainable.

    *Vladimir Kochnev*

*   Fix n+1 query problem when eager loading nil associations (fixes #18312)

    *Sammy Larbi*

*   Fixed an error which would occur in dirty checking when calling
    `update_attributes` from a getter.

    Fixes #20531.

    *Sean Griffin*

*   Ensure symbols passed to `ActiveRecord::Relation#select` are always treated
    as columns.

    Fixes #20360.

    *Sean Griffin*

*   Clear query cache when `ActiveRecord::Base#reload` is called.

    *Shane Hender*

*   Pass `:extend` option for `has_and_belongs_to_many` associations to the
    underlying `has_many :through`.

    *Jaehyun Shin*

*   Make `unscope` aware of "less than" and "greater than" conditions.

    *TAKAHASHI Kazuaki*

*   Revert behavior of `db:schema:load` back to loading the full
    environment. This ensures that initializers are run.

    Fixes #19545.

    *Yves Senn*

*   Fix missing index when using `timestamps` with the `index` option.

    The `index` option used with `timestamps` should be passed to both
    `column` definitions for `created_at` and `updated_at` rather than just
    the first.

    *Paul Mucur*

*   Rename `:class` to `:anonymous_class` in association options.

    Fixes #19659.

    *Andrew White*

*   Fixed a bug where uniqueness validations would error on out of range values,
    even if an validation should have prevented it from hitting the database.

    *Andrey Voronkov*

*   Foreign key related methods in the migration DSL respect
    `ActiveRecord::Base.pluralize_table_names = false`.

    Fixes #19643.

    *Mehmet Emin İNAÇ*

*   Reduce memory usage from loading types on pg.

    Fixes #19578.

    *Sean Griffin*

*   Fix referencing wrong table aliases while joining tables of has many through
    association (only when calling calculation methods).

    Fixes #19276.

    *pinglamb*

*   Don't attempt to update counter caches, when the column wasn't selected.

    Fixes #19437.

    *Sean Griffin*

*   Correctly persist a serialized attribute that has been returned to
    its default value by an in-place modification.

    Fixes #19467.

    *Matthew Draper*

*   Fix default `format` value in `ActiveRecord::Tasks::DatabaseTasks#schema_file`.

    *James Cox*

*   Dont enroll records in the transaction if they dont have commit callbacks.
    That was causing a memory grow problem when creating a lot of records inside a transaction.

    Fixes #15549.

    *Will Bryant*, *Aaron Patterson*

*   Correctly create through records when created on a has many through
    association when using `where`.

    Fixes #19073.

    *Sean Griffin*


## Rails 4.2.2 (June 16, 2015) ##

* No Changes *


## Rails 4.2.1 (March 19, 2015) ##

*   Fixed ActiveRecord::Relation#becomes! and changed_attributes issues for type column

    Fixes #17139.

    *Miklos Fazekas*

*   `remove_reference` with `foreign_key: true` removes the foreign key before
    removing the column. This fixes a bug where it was not possible to remove
    the column on MySQL.

    Fixes #18664.

    *Yves Senn*

*   Add a `:foreign_key` option to `references` and associated migration
    methods. The model and migration generators now use this option, rather than
    the `add_foreign_key` form.

    *Sean Griffin*

*   Fix rounding problem for PostgreSQL timestamp column.

    If timestamp column have the precision, it need to format according to
    the precision of timestamp column.

    *Ryuta Kamizono*

*   Respect the database default charset for `schema_migrations` table.

    The charset of `version` column in `schema_migrations` table is depend
    on the database default charset and collation rather than the encoding
    of the connection.

    *Ryuta Kamizono*

*   Respect custom primary keys for associations when calling `Relation#where`

    Fixes #18813.

    *Sean Griffin*

*   Fixed several edge cases which could result in a counter cache updating
    twice or not updating at all for `has_many` and `has_many :through`.

    Fixes #10865.

    *Sean Griffin*

*   Foreign keys added by migrations were given random, generated names. This
    meant a different `structure.sql` would be generated every time a developer
    ran migrations on their machine.

    The generated part of foreign key names is now a hash of the table name and
    column name, which is consistent every time you run the migration.

    *Chris Sinjakli*

*   Fixed ActiveRecord::Relation#group method when argument is SQL reserved key word:

      SplitTest.group(:key).count
      Property.group(:value).count

    *Bogdan Gusiev*

*   Don't define autosave association callbacks twice from
    `accepts_nested_attributes_for`.

    Fixes #18704.

    *Sean Griffin*

*   Integer types will no longer raise a `RangeError` when assigning an
    attribute, but will instead raise when going to the database.

    Fixes several vague issues which were never reported directly. See the
    commit message from the commit which added this line for some examples.

    *Sean Griffin*

*   Values which would error while being sent to the database (such as an
    ASCII-8BIT string with invalid UTF-8 bytes on Sqlite3), no longer error on
    assignment. They will still error when sent to the database, but you are
    given the ability to re-assign it to a valid value.

    Fixes #18580.

    *Sean Griffin*

*   Don't remove join dependencies in `Relation#exists?`

    Fixes #18632.

    *Sean Griffin*

*   Invalid values assigned to a JSON column are assumed to be `nil`.

    Fixes #18629.

    *Sean Griffin*

*   No longer issue deprecation warning when including a scope with extensions.
    Previously every scope with extension methods was transformed into an
    instance dependent scope. Including such a scope would wrongfully issue a
    deprecation warning. This is no longer the case.

    Fixes #18467.

    *Yves Senn*

*   Correctly use the type provided by `serialize` when updating records using
    optimistic locking.

    Fixes #18385.

    *Sean Griffin*

*   `attribute_will_change!` will no longer cause non-persistable attributes to
    be sent to the database.

    Fixes #18407.

    *Sean Griffin*

*   Format the datetime string according to the precision of the datetime field.

    Incompatible to rounding behavior between MySQL 5.6 and earlier.

    In 5.5, when you insert `2014-08-17 12:30:00.999999` the fractional part
    is ignored. In 5.6, it's rounded to `2014-08-17 12:30:01`:

    http://bugs.mysql.com/bug.php?id=68760

    *Ryuta Kamizono*

*   Allow precision option for MySQL datetimes.

    *Ryuta Kamizono*

*   Clear query cache on rollback.

    *Florian Weingarten*

*   Fixed setting of foreign_key for through associations while building of new record.

    Fixes #12698.

    *Ivan Antropov*

*   Fixed automatic inverse_of for models nested in module.

    *Andrew McCloud*

*   Fix `reaping_frequency` option when the value is a string.

    This usually happens when it is configured using `DATABASE_URL`.

    *korbin*

*   Fix error message when trying to create an associated record and the foreign
    key is missing.

    Before this fix the following exception was being raised:

        NoMethodError: undefined method `val' for #<Arel::Nodes::BindParam:0x007fc64d19c218>

    Now the message is:

        ActiveRecord::UnknownAttributeError: unknown attribute 'foreign_key' for Model.

    *Rafael Mendonça França*

*   Fix change detection problem for PostgreSQL bytea type and
    `ArgumentError: string contains null byte` exception with pg-0.18.

    Fixes #17680.

    *Lars Kanis*

*   When a table has a composite primary key, the `primary_key` method for
    SQLite3 and PostgreSQL adapters was only returning the first field of the key.
    Ensures that it will return nil instead, as Active Record doesn't support
    composite primary keys.

    Fixes #18070.

    *arthurnn*

*   Ensure `first!` and friends work on loaded associations.

    Fixes #18237.

    *Sean Griffin*

*   Dump the default `nil` for PostgreSQL UUID primary key.

    *Ryuta Kamizono*

*   Don't raise when writing an attribute with an out-of-range datetime passed
    by the user.

    *Grey Baker*

*   Fixes bug with 'ActiveRecord::Type::Numeric' that causes negative values to
    be marked as having changed when set to the same negative value.

    Fixes #18161.

    *Daniel Fox*


## Rails 4.2.0 (December 20, 2014) ##

*   Introduce `force: :cascade` option for `create_table`. Using this option
    will recreate tables even if they have dependent objects (like foreign keys).
    `db/schema.rb` now uses `force: :cascade`. This makes it possible to
    reload the schema when foreign keys are in place.

    *Matthew Draper*, *Yves Senn*

*   `db:schema:load` and `db:structure:load` no longer purge the database
    before loading the schema. This is left for the user to do.
    `db:test:prepare` will still purge the database.

    Fixes #17945.

    *Yves Senn*

*   Fix undesirable RangeError by Type::Integer. Add Type::UnsignedInteger.

    *Ryuta Kamizono*

*   Add `foreign_type` option to `has_one` and `has_many` association macros.

    This option enables to define the column name of associated object's type for polymorphic associations.

    *Ulisses Almeida, Kassio Borges*

*   `add_timestamps` and `remove_timestamps` now properly reversible with
    options.

    *Noam Gagliardi-Rabinovich*

*   Bring back `db:test:prepare` to synchronize the test database schema.

    Manual synchronization using `bin/rake db:test:prepare` is required
    when a migration is rolled-back, edited and reapplied.

    `ActiveRecord::Base.maintain_test_schema` now uses `db:test:prepare`
    to synchronize the schema. Plugins can use this task as a hook to
    provide custom behavior after the schema has been loaded.

    NOTE: `test:prepare` runs before the schema is synchronized.

    Fixes #17171, #15787.

    *Yves Senn*

*   Change `reflections` public api to return the keys as String objects.

    Fixes #16928.

    *arthurnn*

*   Renaming a table in pg also renames the primary key index.

    Fixes #12856

    *Sean Griffin*

*   Make it possible to access fixtures excluded by a `default_scope`.

    *Yves Senn*

*   Fix preloading of associations with a scope containing joins along with
    conditions on the joined association.

    *Siddharth Sharma*

*   Add `Table#name` to match `TableDefinition#name`.

    *Cody Cutrer*

*   Cache `CollectionAssociation#reader` proxies separately before and after
    the owner has been saved so that the proxy is not cached without the
    owner's id.

    *Ben Woosley*

*   `ActiveRecord::ReadOnlyRecord` now has a descriptive message.

    *Franky W.*

*   Fix preloading of associations which unscope a default scope.

    Fixes #11036.

    *Byron Bischoff*

*   Added SchemaDumper support for tables with jsonb columns.

    *Ted O'Meara*

*   Deprecate `sanitize_sql_hash_for_conditions` without replacement. Using a
    `Relation` for performing queries and updates is the prefered API.

    *Sean Griffin*

*   Queries now properly type cast values that are part of a join statement,
    even when using type decorators such as `serialize`.

    *Melanie Gilman & Sean Griffin*

*   MySQL enum type lookups, with values matching another type, no longer result
    in an endless loop.

    Fixes #17402.

    *Yves Senn*

*   Raise `ArgumentError` when the body of a scope is not callable.

    *Mauro George*

*   Use type column first in multi-column indexes created with `add-reference`.

    *Derek Prior*

*   Fix `Relation.rewhere` to work with Range values.

    *Dan Olson*

*   `AR::UnknownAttributeError` now includes the class name of a record.

        User.new(name: "Yuki Nishijima", project_attributes: {name: "kaminari"})
        # => ActiveRecord::UnknownAttributeError: unknown attribute 'name' for User.

    *Yuki Nishijima*

*   Fix a regression causing `after_create` callbacks to run before associated
    records are autosaved.

    Fixes #17209.

    *Agis Anastasopoulos*

*   Honor overridden `rack.test` in Rack environment for the connection
    management middleware.

    *Simon Eskildsen*

*   Add a truncate method to the connection.

    *Aaron Patterson*

*   Don't autosave unchanged has_one through records.

    *Alan Kennedy*, *Steve Parrington*

*   Do not dump foreign keys for ignored tables.

    *Yves Senn*

*   PostgreSQL adapter correctly dumps foreign keys targeting tables
    outside the schema search path.

    Fixes #16907.

    *Matthew Draper*, *Yves Senn*

*   When a thread is killed, rollback the active transaction, instead of
    committing it during the stack unwind. Previously, we could commit half-
    completed work. This fix only works for Ruby 2.0+; on 1.9, we can't
    distinguish a thread kill from an ordinary non-local (block) return, so must
    default to committing.

    *Chris Hanks*

*   A `NullRelation` should represent nothing. This fixes a bug where
    `Comment.where(post_id: Post.none)` returned a non-empty result.

    Fixes #15176.

    *Matthew Draper*, *Yves Senn*

*   Include default column limits in schema.rb. Allows defaults to be changed
    in the future without affecting old migrations that assumed old defaults.

    *Jeremy Kemper*

*   MySQL: schema.rb now includes TEXT and BLOB column limits.

    *Jeremy Kemper*

*   MySQL: correct LONGTEXT and LONGBLOB limits from 2GB to their true 4GB.

    *Jeremy Kemper*

*   SQLite3Adapter now checks for views in `table_exists?`. Fixes #14041.

    *Girish Sonawane*

*   Introduce `connection.supports_views?` to check whether the current adapter
    has support for SQL views. Connection adapters should define this method.

    *Yves Senn*

*   Allow included modules to override association methods.

    Fixes #16684.

    *Yves Senn*

*   Schema loading rake tasks (like `db:schema:load` and `db:setup`) maintain
    the database connection to the current environment.

    Fixes #16757.

    *Joshua Cody*, *Yves Senn*

*   MySQL: set the connection collation along with the charset.

    Sets the connection collation to the database collation configured in
    database.yml. Otherwise, `SET NAMES utf8mb4` will use the default
    collation for that charset (utf8mb4_general_ci) when you may have chosen
    a different collation, like utf8mb4_unicode_ci.

    This only applies to literal string comparisons, not column values, so it
    is unlikely to affect you.

    *Jeremy Kemper*

*   `default_sequence_name` from the PostgreSQL adapter returns a `String`.

    *Yves Senn*

*   Fix a regression where whitespaces were stripped from DISTINCT queries in
    PostgreSQL.

    *Agis Anastasopoulos*

    Fixes #16623.

*   Fix has_many :through relation merging failing when dynamic conditions are
    passed as a lambda with an arity of one.

    Fixes #16128.

    *Agis Anastasopoulos*

*   Fix `Relation#exists?` to work with polymorphic associations.

    Fixes #15821.

    *Kassio Borges*

*   Currently, Active Record rescues any errors raised within
    `after_rollback`/`after_create` callbacks and prints them to the logs.
    Future versions of Rails will not rescue these errors anymore and
    just bubble them up like the other callbacks.

    This commit adds an opt-in flag to enable not rescuing the errors.

    Example:

        # Do not swallow errors in after_commit/after_rollback callbacks.
        config.active_record.raise_in_transactional_callbacks = true

    Fixes #13460.

    *arthurnn*

*   Fix an issue where custom accessor methods (such as those generated by
    `enum`) with the same name as a global method are incorrectly overridden
    when subclassing.

    Fixes #16288.

    *Godfrey Chan*

*   `*_was` and `changes` now work correctly for in-place attribute changes as
    well.

    *Sean Griffin*

*   Fix regression on `after_commit` that did not fire with nested transactions.

    Fixes #16425.

    *arthurnn*

*   Do not try to write timestamps when a table has no timestamps columns.

    Fixes #8813.

    *Sergey Potapov*

*   `index_exists?` with `:name` option does verify specified columns.

    Example:

        add_index :articles, :title, name: "idx_title"

        # Before:
        index_exists? :articles, :title, name: "idx_title" # => `true`
        index_exists? :articles, :body, name: "idx_title" # => `true`

        # After:
        index_exists? :articles, :title, name: "idx_title" # => `true`
        index_exists? :articles, :body, name: "idx_title" # => `false`

    *Yves Senn*, *Matthew Draper*

*   `add_timestamps` and `t.timestamps` now require you to pass the `:null` option.
    Not passing the option is deprecated but the default is still `null: true`.
    With Rails 5 this will change to `null: false`.

    *Sean Griffin*

*   When calling `update_columns` on a record that is not persisted, the error
    message now reflects whether that object is a new record or has been
    destroyed.

    *Lachlan Sylvester*

*   Define `id_was` to get the previous value of the primary key.

    Currently when we call `id_was` and we have a custom primary key name,
    Active Record will return the current value of the primary key. This
    makes it impossible to correctly do an update operation if you change the
    id.

    Fixes #16413.

    *Rafael Mendonça França*

*   Deprecate `DatabaseTasks.load_schema` to act on the current connection.
    Use `.load_schema_current` instead. In the future `load_schema` will
    require the `configuration` to act on as an argument.

    *Yves Senn*

*   Fix automatic maintaining test schema to properly handle sql structure
    schema format.

    Fixes #15394.

    *Wojciech Wnętrzak*

*   Fix type casting to Decimal from Float with large precision.

    *Tomohiro Hashidate*

*   Deprecate `Reflection#source_macro`

    `Reflection#source_macro` is no longer needed in Active Record
    source so it has been deprecated. Code that used `source_macro`
    was removed in #16353.

    *Eileen M. Uchtitelle*, *Aaron Patterson*

*   No verbose backtrace by `db:drop` when database does not exist.

    Fixes #16295.

    *Kenn Ejima*

*   Add support for PostgreSQL JSONB.

    Example:

        create_table :posts do |t|
          t.jsonb :meta_data
        end

    *Philippe Creux*, *Chris Teague*

*   `db:purge` with MySQL respects `Rails.env`.

    *Yves Senn*

*   `change_column_default :table, :column, nil` with PostgreSQL will issue a
    `DROP DEFAULT` instead of a `DEFAULT NULL` query.

    Fixes #16261.

    *Matthew Draper*, *Yves Senn*

*   Allow to specify a type for the foreign key column in `references`
    and `add_reference`.

    Example:

        change_table :vehicle do |t|
          t.references :station, type: :uuid
        end

    *Andrey Novikov*, *Łukasz Sarnacki*

*   `create_join_table` removes a common prefix when generating the join table.
    This matches the existing behavior of HABTM associations.

    Fixes #13683.

    *Stefan Kanev*

*   Do not swallow errors on `compute_type` when having a bad `alias_method` on
    a class.

    *arthurnn*

*   PostgreSQL invalid `uuid` are convert to nil.

    *Abdelkader Boudih*

*   Restore 4.0 behavior for using serialize attributes with `JSON` as coder.

    With 4.1.x, `serialize` started returning a string when `JSON` was passed as
    the second attribute. It will now return a hash as per previous versions.

    Example:

        class Post < ActiveRecord::Base
          serialize :comment, JSON
        end

        class Comment
          include ActiveModel::Model
          attr_accessor :category, :text
        end

        post = Post.create!
        post.comment = Comment.new(category: "Animals", text: "This is a comment about squirrels.")
        post.save!

        # 4.0
        post.comment # => {"category"=>"Animals", "text"=>"This is a comment about squirrels."}

        # 4.1 before
        post.comment # => "#<Comment:0x007f80ab48ff98>"

        # 4.1 after
        post.comment # => {"category"=>"Animals", "text"=>"This is a comment about squirrels."}

    When using `JSON` as the coder in `serialize`, Active Record will use the
    new `ActiveRecord::Coders::JSON` coder which delegates its `dump/load` to
    `ActiveSupport::JSON.encode/decode`. This ensures special objects are dumped
    correctly using the `#as_json` hook.

    To keep the previous behaviour, supply a custom coder instead
    ([example](https://gist.github.com/jenncoop/8c4142bbe59da77daa63)).

    Fixes #15594.

    *Jenn Cooper*

*   Do not use `RENAME INDEX` syntax for MariaDB 10.0.

    Fixes #15931.

    *Jeff Browning*

*   Calling `#empty?` on a `has_many` association would use the value from the
    counter cache if one exists.

    *David Verhasselt*

*   Fix the schema dump generated for tables without constraints and with
    primary key with default value of custom PostgreSQL function result.

    Fixes #16111.

    *Andrey Novikov*

*   Fix the SQL generated when a `delete_all` is run on an association to not
    produce an `IN` statements.

    Before:

      UPDATE "categorizations" SET "category_id" = NULL WHERE
      "categorizations"."category_id" = 1 AND "categorizations"."id" IN (1, 2)

    After:

      UPDATE "categorizations" SET "category_id" = NULL WHERE
      "categorizations"."category_id" = 1

    *Eileen M. Uchitelle, Aaron Patterson*

*   Avoid type casting boolean and `ActiveSupport::Duration` values to numeric
    values for string columns. Otherwise, in some database, the string column
    values will be coerced to a numeric allowing false or 0.seconds match any
    string starting with a non-digit.

    Example:

        App.where(apikey: false) # => SELECT * FROM users WHERE apikey = '0'

    *Dylan Thacker-Smith*

*   Add a `:required` option to singular associations, providing a nicer
    API for presence validations on associations.

    *Sean Griffin*

*   Fix an error in `reset_counters` when associations have `select` scope.
    (Call to `count` generated invalid SQL.)

    *Cade Truitt*

*   After a successful `reload`, `new_record?` is always false.

    Fixes #12101.

    *Matthew Draper*

*   PostgreSQL renaming table doesn't attempt to rename non existent sequences.

    *Abdelkader Boudih*

*   Move 'dependent: :destroy' handling for `belongs_to`
    from `before_destroy` to `after_destroy` callback chain

    Fixes #12380.

    *Ivan Antropov*

*   Detect in-place modifications on String attributes.

    Before this change, an attribute modified in-place had to be marked as
    changed in order for it to be persisted in the database. Now it is no longer
    required.

    Before:

        user = User.first
        user.name << ' Griffin'
        user.name_will_change!
        user.save
        user.reload.name # => "Sean Griffin"

    After:

        user = User.first
        user.name << ' Griffin'
        user.save
        user.reload.name # => "Sean Griffin"

    *Sean Griffin*

*   Add `ActiveRecord::Base#validate!` that raises `RecordInvalid` if the record
    is invalid.

    *Bogdan Gusiev*, *Marc Schütz*

*   Support for adding and removing foreign keys. Foreign keys are now
    a part of `schema.rb`. This is supported by Mysql2Adapter, MysqlAdapter
    and PostgreSQLAdapter.

    Many thanks to *Matthew Higgins* for laying the foundation with his work on
    [foreigner](https://github.com/matthuhiggins/foreigner).

    Example:

        # within your migrations:
        add_foreign_key :articles, :authors
        remove_foreign_key :articles, :authors

    *Yves Senn*

*   Fix subtle bugs regarding attribute assignment on models with no primary
    key. `'id'` will no longer be part of the attributes hash.

    *Sean Griffin*

*   Deprecate automatic counter caches on `has_many :through`. The behavior was
    broken and inconsistent.

    *Sean Griffin*

*   `preload` preserves readonly flag for associations.

    See #15853.

    *Yves Senn*

*   Assume numeric types have changed if they were assigned to a value that
    would fail numericality validation, regardless of the old value. Previously
    this would only occur if the old value was 0.

    Example:

        model = Model.create!(number: 5)
        model.number = '5wibble'
        model.number_changed? # => true

    Fixes #14731.

    *Sean Griffin*

*   `reload` no longer merges with the existing attributes.
    The attribute hash is fully replaced. The record is put into the same state
    as it would be with `Model.find(model.id)`.

    *Sean Griffin*

*   The object returned from `select_all` must respond to `column_types`.
    If this is not the case a `NoMethodError` is raised.

    *Sean Griffin*

*   Detect in-place modifications of PG array types

    *Sean Griffin*

*   Add `bin/rake db:purge` task to empty the current database.

    *Yves Senn*

*   Deprecate `serialized_attributes` without replacement.

    *Sean Griffin*

*   Correctly extract IPv6 addresses from `DATABASE_URI`: the square brackets
    are part of the URI structure, not the actual host.

    Fixes #15705.

    *Andy Bakun*, *Aaron Stone*

*   Ensure both parent IDs are set on join records when both sides of a
    through association are new.

    *Sean Griffin*

*   `ActiveRecord::Dirty` now detects in-place changes to mutable values.
    Serialized attributes on ActiveRecord models will no longer save when
    unchanged.

    Fixes #8328.

    *Sean Griffin*

*   `Pluck` now works when selecting columns from different tables with the same
    name.

    Fixes #15649.

    *Sean Griffin*

*   Remove `cache_attributes` and friends. All attributes are cached.

    *Sean Griffin*

*   Remove deprecated method `ActiveRecord::Base.quoted_locking_column`.

    *Akshay Vishnoi*

*   `ActiveRecord::FinderMethods.find` with block can handle proc parameter as
    `Enumerable#find` does.

    Fixes #15382.

    *James Yang*

*   Make timezone aware attributes work with PostgreSQL array columns.

    Fixes #13402.

    *Kuldeep Aggarwal*, *Sean Griffin*

*   `ActiveRecord::SchemaMigration` has no primary key regardless of the
    `primary_key_prefix_type` configuration.

    Fixes #15051.

    *JoseLuis Torres*, *Yves Senn*

*   `rake db:migrate:status` works with legacy migration numbers like `00018_xyz.rb`.

    Fixes #15538.

    *Yves Senn*

*   Baseclass becomes! subclass.

    Before this change, a record which changed its STI type, could not be
    updated.

    Fixes #14785.

    *Matthew Draper*, *Earl St Sauver*, *Edo Balvers*

*   Remove deprecated `ActiveRecord::Migrator.proper_table_name`. Use the
    `proper_table_name` instance method on `ActiveRecord::Migration` instead.

    *Akshay Vishnoi*

*   Fix regression on eager loading association based on SQL query rather than
    existing column.

    Fixes #15480.

    *Lauro Caetano*, *Carlos Antonio da Silva*

*   Deprecate returning `nil` from `column_for_attribute` when no column exists.
    It will return a null object in Rails 5.0

    *Sean Griffin*

*   Implemented `ActiveRecord::Base#pretty_print` to work with PP.

    *Ethan*

*   Preserve type when dumping PostgreSQL point, bit, bit varying and money
    columns.

    *Yves Senn*

*   New records remain new after YAML serialization.

    *Sean Griffin*

*   PostgreSQL support default values for enum types. Fixes #7814.

    *Yves Senn*

*   PostgreSQL `default_sequence_name` respects schema. Fixes #7516.

    *Yves Senn*

*   Fix `columns_for_distinct` of PostgreSQL adapter to work correctly
    with orders without sort direction modifiers.

    *Nikolay Kondratyev*

*   PostgreSQL `reset_pk_sequence!` respects schemas. Fixes #14719.

    *Yves Senn*

*   Keep PostgreSQL `hstore` and `json` attributes as `Hash` in `@attributes`.
    Fixes duplication in combination with `store_accessor`.

    Fixes #15369.

    *Yves Senn*

*   `rake railties:install:migrations` respects the order of railties.

    *Arun Agrawal*

*   Fix redefine a `has_and_belongs_to_many` inside inherited class
    Fixing regression case, where redefining the same `has_and_belongs_to_many`
    definition into a subclass would raise.

    Fixes #14983.

    *arthurnn*

*   Fix `has_and_belongs_to_many` public reflection.
    When defining a `has_and_belongs_to_many`, internally we convert that to two has_many.
    But as `reflections` is a public API, people expect to see the right macro.

    Fixes #14682.

    *arthurnn*

*   Fix serialization for records with an attribute named `format`.

    Fixes #15188.

    *Godfrey Chan*

*   When a `group` is set, `sum`, `size`, `average`, `minimum` and `maximum`
    on a NullRelation should return a Hash.

    *Kuldeep Aggarwal*

*   Fix serialized fields returning serialized data after being updated with
    `update_column`.

    *Simon Hørup Eskildsen*

*   Fix polymorphic eager loading when using a String as foreign key.

    Fixes #14734.

    *Lauro Caetano*

*   Change belongs_to touch to be consistent with timestamp updates

    If a model is set up with a belongs_to: touch relationship the parent
    record will only be touched if the record was modified. This makes it
    consistent with timestamp updating on the record itself.

    *Brock Trappitt*

*   Fix the inferred table name of a `has_and_belongs_to_many` auxiliary
    table inside a schema.

    Fixes #14824.

    *Eric Chahin*

*   Remove unused `:timestamp` type. Transparently alias it to `:datetime`
    in all cases. Fixes inconsistencies when column types are sent outside of
    `ActiveRecord`, such as for XML Serialization.

    *Sean Griffin*

*   Fix bug that added `table_name_prefix` and `table_name_suffix` to
    extension names in PostgreSQL when migrating.

    *Joao Carlos*

*   The `:index` option in migrations, which previously was only available for
    `references`, now works with any column types.

    *Marc Schütz*

*   Add support for counter name to be passed as parameter on `CounterCache::ClassMethods#reset_counters`.

    *jnormore*

*   Restrict deletion of record when using `delete_all` with `uniq`, `group`, `having`
    or `offset`.

    In these cases the generated query ignored them and that caused unintended
    records to be deleted.

    Fixes #11985.

    *Leandro Facchinetti*

*   Floats with limit >= 25 that get turned into doubles in MySQL no longer have
    their limit dropped from the schema.

    Fixes #14135.

    *Aaron Nelson*

*   Fix how to calculate associated class name when using namespaced `has_and_belongs_to_many`
    association.

    Fixes #14709.

    *Kassio Borges*

*   `ActiveRecord::Relation::Merger#filter_binds` now compares equivalent symbols and
    strings in column names as equal.

    This fixes a rare case in which more bind values are passed than there are
    placeholders for them in the generated SQL statement, which can make PostgreSQL
    throw a `StatementInvalid` exception.

    *Nat Budin*

*   Fix `stored_attributes` to correctly merge the details of stored
    attributes defined in parent classes.

    Fixes #14672.

    *Brad Bennett*, *Jessica Yao*, *Lakshmi Parthasarathy*

*   `change_column_default` allows `[]` as argument to `change_column_default`.

    Fixes #11586.

    *Yves Senn*

*   Handle `name` and `"char"` column types in the PostgreSQL adapter.

    `name` and `"char"` are special character types used internally by
    PostgreSQL and are used by internal system catalogs. These field types
    can sometimes show up in structure-sniffing queries that feature internal system
    structures or with certain PostgreSQL extensions.

    *J Smith*, *Yves Senn*

*   Fix `PostgreSQLAdapter::OID::Float#type_cast` to convert Infinity and
    NaN PostgreSQL values into a native Ruby `Float::INFINITY` and `Float::NAN`

    Before:

        Point.create(value: 1.0/0)
        Point.last.value # => 0.0

    After:

        Point.create(value: 1.0/0)
        Point.last.value # => Infinity

    *Innokenty Mikhailov*

*   Allow the PostgreSQL adapter to handle bigserial primary key types again.

    Fixes #10410.

    *Patrick Robertson*

*   Deprecate joining, eager loading and preloading of instance dependent
    associations without replacement. These operations happen before instances
    are created. The current behavior is unexpected and can result in broken
    behavior.

    Fixes #15024.

    *Yves Senn*

*   Fix `has_and_belongs_to_many` CollectionAssociation size calculations.

    `has_and_belongs_to_many` should fall back to using the normal CollectionAssociation's
    size calculation if the collection is not cached or loaded.

    Fixes #14913, #14914.

    *Fred Wu*

*   Return a non zero status when running `rake db:migrate:status` and migration table does
    not exist.

    *Paul B.*

*   Add support for module-level `table_name_suffix` in models.

    This makes `table_name_suffix` work the same way as `table_name_prefix` when
    using namespaced models.

    *Jenner LaFave*

*   Revert the behaviour of `ActiveRecord::Relation#join` changed through 4.0 => 4.1 to 4.0.

    In 4.1.0 `Relation#join` is delegated to `Arel#SelectManager`.
    In 4.0 series it is delegated to `Array#join`.

    *Bogdan Gusiev*

*   Log nil binary column values correctly.

    When an object with a binary column is updated with a nil value
    in that column, the SQL logger would throw an exception when trying
    to log that nil value. This only occurs when updating a record
    that already has a non-nil value in that column since an initial nil
    value isn't included in the SQL anyway (at least, when dirty checking
    is enabled.) The column's new value will now be logged as `<NULL binary data>`
    to parallel the existing `<N bytes of binary data>` for non-nil values.

    *James Coleman*

*   Rails will now pass a custom validation context through to autosave associations
    in order to validate child associations with the same context.

    Fixes #13854.

    *Eric Chahin*, *Aaron Nelson*, *Kevin Casey*

*   Stringify all variables keys of MySQL connection configuration.

    When `sql_mode` variable for MySQL adapters set in configuration as `String`
    was ignored and overwritten by strict mode option.

    Fixes #14895.

    *Paul Nikitochkin*

*   Ensure SQLite3 statements are closed on errors.

    Fixes #13631.

    *Timur Alperovich*

*   Give `ActiveRecord::PredicateBuilder` private methods the privacy they deserve.

    *Hector Satre*

*   When using a custom `join_table` name on a `habtm`, rails was not saving it
    on Reflections. This causes a problem when rails loads fixtures, because it
    uses the reflections to set database with fixtures.

    Fixes #14845.

    *Kassio Borges*

*   Reset the cache when modifying a Relation with cached Arel.
    Additionally display a warning message to make the user aware.

    *Yves Senn*

*   PostgreSQL should internally use `:datetime` consistently for TimeStamp. Assures
    different spellings of timestamps are treated the same.

    Example:

        mytimestamp.simplified_type('timestamp without time zone')
        # => :datetime
        mytimestamp.simplified_type('timestamp(6) without time zone')
        # => also :datetime (previously would be :timestamp)

    See #14513.

    *Jefferson Lai*

*   `ActiveRecord::Base.no_touching` no longer triggers callbacks or start empty transactions.

    Fixes #14841.

    *Lucas Mazza*

*   Fix name collision with `Array#select!` with `Relation#select!`.

    Fixes #14752.

    *Earl St Sauver*

*   Fix unexpected behavior for `has_many :through` associations going through
    a scoped `has_many`.

    If a `has_many` association is adjusted using a scope, and another
    `has_many :through` uses this association, then the scope adjustment is
    unexpectedly neglected.

    Fixes #14537.

    *Jan Habermann*

*   `@destroyed` should always be set to `false` when an object is duped.

    *Kuldeep Aggarwal*

*   Enable `has_many` associations to support irregular inflections.

    Fixes #8928.

    *arthurnn*, *Javier Goizueta*

*   Fix `count` used with a grouping not returning a Hash.

    Fixes #14721.

    *Eric Chahin*

*   `sanitize_sql_like` helper method to escape a string for safe use in an SQL
    LIKE statement.

    Example:

        class Article
          def self.search(term)
            where("title LIKE ?", sanitize_sql_like(term))
          end
        end

        Article.search("20% _reduction_")
        # => Query looks like "... title LIKE '20\% \_reduction\_' ..."

    *Rob Gilson*, *Yves Senn*

*   Do not quote uuid default value on `change_column`.

    Fixes #14604.

    *Eric Chahin*

*   The comparison between `Relation` and `CollectionProxy` should be consistent.

    Example:

        author.posts == Post.where(author_id: author.id)
        # => true
        Post.where(author_id: author.id) == author.posts
        # => true

    Fixes #13506.

    *Lauro Caetano*

*   Calling `delete_all` on an unloaded `CollectionProxy` no longer
    generates an SQL statement containing each id of the collection:

    Before:

        DELETE FROM `model` WHERE `model`.`parent_id` = 1
        AND `model`.`id` IN (1, 2, 3...)

    After:

        DELETE FROM `model` WHERE `model`.`parent_id` = 1

    *Eileen M. Uchitelle*, *Aaron Patterson*

*   Fix invalid SQL when aggregate methods (`empty?`, `any?`, `count`) used
    with `select`.

    Fixes #13648.

    *Simon Woker*

*   PostgreSQL adapter only warns once for every missing OID per connection.

    Fixes #14275.

    *Matthew Draper*, *Yves Senn*

*   PostgreSQL adapter automatically reloads it's type map when encountering
    unknown OIDs.

    Fixes #14678.

    *Matthew Draper*, *Yves Senn*

*   Fix insertion of records via `has_many :through` association with scope.

    Fixes #3548.

    *Ivan Antropov*

*   Auto-generate stable fixture UUIDs on PostgreSQL.

    Fixes #11524.

    *Roderick van Domburg*

*   Fix a problem where an enum would overwrite values of another enum with the
    same name in an unrelated class.

    Fixes #14607.

    *Evan Whalen*

*   PostgreSQL and SQLite string columns no longer have a default limit of 255.

    Fixes #13435, #9153.

    *Vladimir Sazhin*, *Toms Mikoss*, *Yves Senn*

*   Make possible to have an association called `records`.

    Fixes #11645.

    *prathamesh-sonpatki*

*   `to_sql` on an association now matches the query that is actually executed, where it
    could previously have incorrectly accrued additional conditions (e.g. as a result of
    a previous query). `CollectionProxy` now always defers to the association scope's
    `arel` method so the (incorrect) inherited one should be entirely concealed.

    Fixes #14003.

    *Jefferson Lai*

*   Block a few default Class methods as scope name.

    For instance, this will raise:

        scope :public, -> { where(status: 1) }

    *arthurnn*

*   Fix error when using `with_options` with lambda.

    Fixes #9805.

    *Lauro Caetano*

*   Switch `sqlite3:///` URLs (which were temporarily
    deprecated in 4.1) from relative to absolute.

    If you still want the previous interpretation, you should replace
    `sqlite3:///my/path` with `sqlite3:my/path`.

    *Matthew Draper*

*   Treat blank UUID values as `nil`.

    Example:

        Sample.new(uuid_field: '') #=> <Sample id: nil, uuid_field: nil>

    *Dmitry Lavrov*

*   Enable support for materialized views on PostgreSQL >= 9.3.

    *Dave Lee*

*   The PostgreSQL adapter supports custom domains. Fixes #14305.

    *Yves Senn*

*   PostgreSQL `Column#type` is now determined through the corresponding OID.
    The column types stay the same except for enum columns. They no longer have
    `nil` as type but `enum`.

    See #7814.

    *Yves Senn*

*   Fix error when specifying a non-empty default value on a PostgreSQL array
    column.

    Fixes #10613.

    *Luke Steensen*

*   Fix error where `.persisted?` throws SystemStackError for an unsaved model with a
    custom primary key that did not save due to validation error.

    Fixes #14393.

    *Chris Finne*

*   Introduce `validate` as an alias for `valid?`.

    This is more intuitive when you want to run validations but don't care about the return value.

    *Henrik Nyh*

*   Create indexes inline in CREATE TABLE for MySQL.

    This is important, because adding an index on a temporary table after it has been created
    would commit the transaction.

    It also allows creating and dropping indexed tables with fewer queries and fewer permissions
    required.

    Example:

        create_table :temp, temporary: true, as: "SELECT id, name, zip FROM a_really_complicated_query" do |t|
          t.index :zip
        end
        # => CREATE TEMPORARY TABLE temp (INDEX (zip)) AS SELECT id, name, zip FROM a_really_complicated_query

    *Cody Cutrer*, *Steve Rice*, *Rafael Mendonça Franca*

*   Use singular table name in generated migrations when
    `ActiveRecord::Base.pluralize_table_names` is `false`.

    Fixes #13426.

    *Kuldeep Aggarwal*

*   `touch` accepts many attributes to be touched at once.

    Example:

        # touches :signed_at, :sealed_at, and :updated_at/on attributes.
        Photo.last.touch(:signed_at, :sealed_at)

    *James Pinto*

*   `rake db:structure:dump` only dumps schema information if the schema
    migration table exists.

    Fixes #14217.

    *Yves Senn*

*   Reap connections that were checked out by now-dead threads, instead
    of waiting until they disconnect by themselves. Before this change,
    a suitably constructed series of short-lived threads could starve
    the connection pool, without ever having more than a couple alive at
    the same time.

    *Matthew Draper*

*   `pk_and_sequence_for` now ensures that only the pg_depend entries
    pointing to pg_class, and thus only sequence objects, are considered.

    *Josh Williams*

*   `where.not` adds `references` for `includes` like normal `where` calls do.

    Fixes #14406.

    *Yves Senn*

*   Extend fixture `$LABEL` replacement to allow string interpolation.

    Example:

        martin:
          email: $LABEL@email.com

        users(:martin).email # => martin@email.com

    *Eric Steele*

*   Add support for `Relation` be passed as parameter on `QueryCache#select_all`.

    Fixes #14361.

    *arthurnn*

*   Passing an Active Record object to `find` or `exists?` is now deprecated.
    Call `.id` on the object first.

    *Aaron Patterson*

*   Only use BINARY for MySQL case sensitive uniqueness check when column
    has a case insensitive collation.

    *Ryuta Kamizono*

*   Support for MySQL 5.6 fractional seconds.

    *arthurnn*, *Tatsuhiko Miyagawa*

*   Support for PostgreSQL `citext` data type enabling case-insensitive
   `where` values without needing to wrap in UPPER/LOWER sql functions.

    *Troy Kruthoff*, *Lachlan Sylvester*

*   Only save has_one associations if record has changes.
    Previously after save related callbacks, such as `#after_commit`, were triggered when the has_one
    object did not get saved to the db.

    *Alan Kennedy*

*   Allow strings to specify the `#order` value.

    Example:

        Model.order(id: 'asc').to_sql == Model.order(id: :asc).to_sql

    *Marcelo Casiraghi*, *Robin Dupret*

*   Dynamically register PostgreSQL enum OIDs. This prevents "unknown OID"
    warnings on enum columns.

    *Dieter Komendera*

*   `includes` is able to detect the right preloading strategy when string
    joins are involved.

    Fixes #14109.

    *Aaron Patterson*, *Yves Senn*

*   Fix error with validation with enum fields for records where the value for
    any enum attribute is always evaluated as 0 during uniqueness validation.

    Fixes #14172.

    *Vilius Luneckas* *Ahmed AbouElhamayed*

*   `before_add` callbacks are fired before the record is saved on
    `has_and_belongs_to_many` associations *and* on `has_many :through`
    associations.  Before this change, `before_add` callbacks would be fired
    before the record was saved on `has_and_belongs_to_many` associations, but
    *not* on `has_many :through` associations.

    Fixes #14144.

*   Fix STI classes not defining an attribute method if there is a conflicting
    private method defined on its ancestors.

    Fixes #11569.

    *Godfrey Chan*

*   Coerce strings when reading attributes. Fixes #10485.

    Example:

        book = Book.new(title: 12345)
        book.save!
        book.title # => "12345"

    *Yves Senn*

*   Deprecate half-baked support for PostgreSQL range values with excluding beginnings.
    We currently map PostgreSQL ranges to Ruby ranges. This conversion is not fully
    possible because the Ruby range does not support excluded beginnings.

    The current solution of incrementing the beginning is not correct and is now
    deprecated. For subtypes where we don't know how to increment (e.g. `#succ`
    is not defined) it will raise an `ArgumentException` for ranges with excluding
    beginnings.

    *Yves Senn*

*   Support for user created range types in PostgreSQL.

    *Yves Senn*

Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/activerecord/CHANGELOG.md) for previous changes.