activerecord 4.2.0 → 5.2.8.1

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 (274) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +640 -928
  3. data/MIT-LICENSE +2 -2
  4. data/README.rdoc +10 -11
  5. data/examples/performance.rb +32 -31
  6. data/examples/simple.rb +5 -4
  7. data/lib/active_record/aggregations.rb +264 -247
  8. data/lib/active_record/association_relation.rb +24 -6
  9. data/lib/active_record/associations/alias_tracker.rb +29 -35
  10. data/lib/active_record/associations/association.rb +87 -41
  11. data/lib/active_record/associations/association_scope.rb +106 -132
  12. data/lib/active_record/associations/belongs_to_association.rb +55 -36
  13. data/lib/active_record/associations/belongs_to_polymorphic_association.rb +8 -8
  14. data/lib/active_record/associations/builder/association.rb +29 -38
  15. data/lib/active_record/associations/builder/belongs_to.rb +77 -30
  16. data/lib/active_record/associations/builder/collection_association.rb +14 -23
  17. data/lib/active_record/associations/builder/has_and_belongs_to_many.rb +50 -39
  18. data/lib/active_record/associations/builder/has_many.rb +6 -4
  19. data/lib/active_record/associations/builder/has_one.rb +13 -6
  20. data/lib/active_record/associations/builder/singular_association.rb +15 -11
  21. data/lib/active_record/associations/collection_association.rb +145 -266
  22. data/lib/active_record/associations/collection_proxy.rb +242 -138
  23. data/lib/active_record/associations/foreign_association.rb +13 -0
  24. data/lib/active_record/associations/has_many_association.rb +35 -75
  25. data/lib/active_record/associations/has_many_through_association.rb +51 -69
  26. data/lib/active_record/associations/has_one_association.rb +39 -24
  27. data/lib/active_record/associations/has_one_through_association.rb +18 -9
  28. data/lib/active_record/associations/join_dependency/join_association.rb +40 -81
  29. data/lib/active_record/associations/join_dependency/join_base.rb +10 -9
  30. data/lib/active_record/associations/join_dependency/join_part.rb +12 -12
  31. data/lib/active_record/associations/join_dependency.rb +134 -154
  32. data/lib/active_record/associations/preloader/association.rb +85 -116
  33. data/lib/active_record/associations/preloader/through_association.rb +85 -74
  34. data/lib/active_record/associations/preloader.rb +83 -93
  35. data/lib/active_record/associations/singular_association.rb +27 -40
  36. data/lib/active_record/associations/through_association.rb +48 -23
  37. data/lib/active_record/associations.rb +1732 -1596
  38. data/lib/active_record/attribute_assignment.rb +58 -182
  39. data/lib/active_record/attribute_decorators.rb +39 -15
  40. data/lib/active_record/attribute_methods/before_type_cast.rb +12 -5
  41. data/lib/active_record/attribute_methods/dirty.rb +94 -125
  42. data/lib/active_record/attribute_methods/primary_key.rb +86 -71
  43. data/lib/active_record/attribute_methods/query.rb +4 -2
  44. data/lib/active_record/attribute_methods/read.rb +45 -63
  45. data/lib/active_record/attribute_methods/serialization.rb +40 -20
  46. data/lib/active_record/attribute_methods/time_zone_conversion.rb +62 -36
  47. data/lib/active_record/attribute_methods/write.rb +31 -46
  48. data/lib/active_record/attribute_methods.rb +170 -117
  49. data/lib/active_record/attributes.rb +201 -74
  50. data/lib/active_record/autosave_association.rb +118 -45
  51. data/lib/active_record/base.rb +60 -48
  52. data/lib/active_record/callbacks.rb +97 -57
  53. data/lib/active_record/coders/json.rb +3 -1
  54. data/lib/active_record/coders/yaml_column.rb +37 -13
  55. data/lib/active_record/collection_cache_key.rb +53 -0
  56. data/lib/active_record/connection_adapters/abstract/connection_pool.rb +712 -284
  57. data/lib/active_record/connection_adapters/abstract/database_limits.rb +10 -5
  58. data/lib/active_record/connection_adapters/abstract/database_statements.rb +254 -87
  59. data/lib/active_record/connection_adapters/abstract/query_cache.rb +72 -22
  60. data/lib/active_record/connection_adapters/abstract/quoting.rb +119 -52
  61. data/lib/active_record/connection_adapters/abstract/savepoints.rb +6 -4
  62. data/lib/active_record/connection_adapters/abstract/schema_creation.rb +67 -46
  63. data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +328 -217
  64. data/lib/active_record/connection_adapters/abstract/schema_dumper.rb +81 -36
  65. data/lib/active_record/connection_adapters/abstract/schema_statements.rb +617 -212
  66. data/lib/active_record/connection_adapters/abstract/transaction.rb +139 -75
  67. data/lib/active_record/connection_adapters/abstract_adapter.rb +332 -191
  68. data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +567 -563
  69. data/lib/active_record/connection_adapters/column.rb +50 -41
  70. data/lib/active_record/connection_adapters/connection_specification.rb +147 -135
  71. data/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb +33 -0
  72. data/lib/active_record/connection_adapters/mysql/column.rb +27 -0
  73. data/lib/active_record/connection_adapters/mysql/database_statements.rb +140 -0
  74. data/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb +72 -0
  75. data/lib/active_record/connection_adapters/mysql/quoting.rb +44 -0
  76. data/lib/active_record/connection_adapters/mysql/schema_creation.rb +73 -0
  77. data/lib/active_record/connection_adapters/mysql/schema_definitions.rb +87 -0
  78. data/lib/active_record/connection_adapters/mysql/schema_dumper.rb +80 -0
  79. data/lib/active_record/connection_adapters/mysql/schema_statements.rb +148 -0
  80. data/lib/active_record/connection_adapters/mysql/type_metadata.rb +35 -0
  81. data/lib/active_record/connection_adapters/mysql2_adapter.rb +42 -195
  82. data/lib/active_record/connection_adapters/postgresql/column.rb +35 -11
  83. data/lib/active_record/connection_adapters/postgresql/database_statements.rb +46 -115
  84. data/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb +44 -0
  85. data/lib/active_record/connection_adapters/postgresql/oid/array.rb +50 -57
  86. data/lib/active_record/connection_adapters/postgresql/oid/bit.rb +10 -6
  87. data/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb +2 -0
  88. data/lib/active_record/connection_adapters/postgresql/oid/bytea.rb +5 -2
  89. data/lib/active_record/connection_adapters/postgresql/oid/cidr.rb +5 -1
  90. data/lib/active_record/connection_adapters/postgresql/oid/date.rb +13 -1
  91. data/lib/active_record/connection_adapters/postgresql/oid/date_time.rb +9 -13
  92. data/lib/active_record/connection_adapters/postgresql/oid/decimal.rb +3 -1
  93. data/lib/active_record/connection_adapters/postgresql/oid/enum.rb +7 -3
  94. data/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +31 -19
  95. data/lib/active_record/connection_adapters/postgresql/oid/inet.rb +2 -0
  96. data/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb +3 -11
  97. data/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb +45 -0
  98. data/lib/active_record/connection_adapters/postgresql/oid/money.rb +7 -9
  99. data/lib/active_record/connection_adapters/postgresql/oid/{integer.rb → oid.rb} +6 -2
  100. data/lib/active_record/connection_adapters/postgresql/oid/point.rb +33 -11
  101. data/lib/active_record/connection_adapters/postgresql/oid/range.rb +52 -34
  102. data/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb +4 -1
  103. data/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb +65 -51
  104. data/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +5 -3
  105. data/lib/active_record/connection_adapters/postgresql/oid/vector.rb +3 -1
  106. data/lib/active_record/connection_adapters/postgresql/oid/xml.rb +3 -1
  107. data/lib/active_record/connection_adapters/postgresql/oid.rb +23 -25
  108. data/lib/active_record/connection_adapters/postgresql/quoting.rb +107 -47
  109. data/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +27 -14
  110. data/lib/active_record/connection_adapters/postgresql/schema_creation.rb +65 -0
  111. data/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +144 -90
  112. data/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +50 -0
  113. data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +466 -280
  114. data/lib/active_record/connection_adapters/postgresql/type_metadata.rb +39 -0
  115. data/lib/active_record/connection_adapters/postgresql/utils.rb +12 -8
  116. data/lib/active_record/connection_adapters/postgresql_adapter.rb +439 -330
  117. data/lib/active_record/connection_adapters/schema_cache.rb +48 -24
  118. data/lib/active_record/connection_adapters/sql_type_metadata.rb +34 -0
  119. data/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb +21 -0
  120. data/lib/active_record/connection_adapters/sqlite3/quoting.rb +67 -0
  121. data/lib/active_record/connection_adapters/sqlite3/schema_creation.rb +17 -0
  122. data/lib/active_record/connection_adapters/sqlite3/schema_definitions.rb +19 -0
  123. data/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb +18 -0
  124. data/lib/active_record/connection_adapters/sqlite3/schema_statements.rb +106 -0
  125. data/lib/active_record/connection_adapters/sqlite3_adapter.rb +269 -324
  126. data/lib/active_record/connection_adapters/statement_pool.rb +34 -13
  127. data/lib/active_record/connection_handling.rb +40 -27
  128. data/lib/active_record/core.rb +205 -202
  129. data/lib/active_record/counter_cache.rb +80 -37
  130. data/lib/active_record/define_callbacks.rb +22 -0
  131. data/lib/active_record/dynamic_matchers.rb +87 -105
  132. data/lib/active_record/enum.rb +136 -90
  133. data/lib/active_record/errors.rb +180 -52
  134. data/lib/active_record/explain.rb +23 -11
  135. data/lib/active_record/explain_registry.rb +4 -2
  136. data/lib/active_record/explain_subscriber.rb +11 -6
  137. data/lib/active_record/fixture_set/file.rb +35 -9
  138. data/lib/active_record/fixtures.rb +193 -135
  139. data/lib/active_record/gem_version.rb +5 -3
  140. data/lib/active_record/inheritance.rb +148 -112
  141. data/lib/active_record/integration.rb +70 -28
  142. data/lib/active_record/internal_metadata.rb +45 -0
  143. data/lib/active_record/legacy_yaml_adapter.rb +48 -0
  144. data/lib/active_record/locale/en.yml +3 -2
  145. data/lib/active_record/locking/optimistic.rb +92 -98
  146. data/lib/active_record/locking/pessimistic.rb +15 -3
  147. data/lib/active_record/log_subscriber.rb +95 -33
  148. data/lib/active_record/migration/command_recorder.rb +133 -90
  149. data/lib/active_record/migration/compatibility.rb +217 -0
  150. data/lib/active_record/migration/join_table.rb +8 -6
  151. data/lib/active_record/migration.rb +594 -267
  152. data/lib/active_record/model_schema.rb +292 -111
  153. data/lib/active_record/nested_attributes.rb +266 -214
  154. data/lib/active_record/no_touching.rb +8 -2
  155. data/lib/active_record/null_relation.rb +24 -37
  156. data/lib/active_record/persistence.rb +350 -119
  157. data/lib/active_record/query_cache.rb +13 -24
  158. data/lib/active_record/querying.rb +19 -17
  159. data/lib/active_record/railtie.rb +117 -35
  160. data/lib/active_record/railties/console_sandbox.rb +2 -0
  161. data/lib/active_record/railties/controller_runtime.rb +9 -3
  162. data/lib/active_record/railties/databases.rake +160 -174
  163. data/lib/active_record/readonly_attributes.rb +5 -4
  164. data/lib/active_record/reflection.rb +447 -288
  165. data/lib/active_record/relation/batches/batch_enumerator.rb +69 -0
  166. data/lib/active_record/relation/batches.rb +204 -55
  167. data/lib/active_record/relation/calculations.rb +259 -244
  168. data/lib/active_record/relation/delegation.rb +67 -60
  169. data/lib/active_record/relation/finder_methods.rb +290 -253
  170. data/lib/active_record/relation/from_clause.rb +26 -0
  171. data/lib/active_record/relation/merger.rb +91 -68
  172. data/lib/active_record/relation/predicate_builder/array_handler.rb +24 -23
  173. data/lib/active_record/relation/predicate_builder/association_query_value.rb +46 -0
  174. data/lib/active_record/relation/predicate_builder/base_handler.rb +19 -0
  175. data/lib/active_record/relation/predicate_builder/basic_object_handler.rb +20 -0
  176. data/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb +56 -0
  177. data/lib/active_record/relation/predicate_builder/range_handler.rb +42 -0
  178. data/lib/active_record/relation/predicate_builder/relation_handler.rb +7 -1
  179. data/lib/active_record/relation/predicate_builder.rb +118 -92
  180. data/lib/active_record/relation/query_attribute.rb +45 -0
  181. data/lib/active_record/relation/query_methods.rb +446 -389
  182. data/lib/active_record/relation/record_fetch_warning.rb +51 -0
  183. data/lib/active_record/relation/spawn_methods.rb +18 -16
  184. data/lib/active_record/relation/where_clause.rb +186 -0
  185. data/lib/active_record/relation/where_clause_factory.rb +34 -0
  186. data/lib/active_record/relation.rb +287 -339
  187. data/lib/active_record/result.rb +54 -36
  188. data/lib/active_record/runtime_registry.rb +6 -4
  189. data/lib/active_record/sanitization.rb +155 -124
  190. data/lib/active_record/schema.rb +30 -24
  191. data/lib/active_record/schema_dumper.rb +91 -87
  192. data/lib/active_record/schema_migration.rb +19 -19
  193. data/lib/active_record/scoping/default.rb +102 -84
  194. data/lib/active_record/scoping/named.rb +81 -32
  195. data/lib/active_record/scoping.rb +45 -26
  196. data/lib/active_record/secure_token.rb +40 -0
  197. data/lib/active_record/serialization.rb +5 -5
  198. data/lib/active_record/statement_cache.rb +45 -35
  199. data/lib/active_record/store.rb +42 -36
  200. data/lib/active_record/suppressor.rb +61 -0
  201. data/lib/active_record/table_metadata.rb +82 -0
  202. data/lib/active_record/tasks/database_tasks.rb +136 -95
  203. data/lib/active_record/tasks/mysql_database_tasks.rb +59 -89
  204. data/lib/active_record/tasks/postgresql_database_tasks.rb +84 -31
  205. data/lib/active_record/tasks/sqlite_database_tasks.rb +44 -16
  206. data/lib/active_record/timestamp.rb +70 -38
  207. data/lib/active_record/touch_later.rb +64 -0
  208. data/lib/active_record/transactions.rb +208 -123
  209. data/lib/active_record/translation.rb +2 -0
  210. data/lib/active_record/type/adapter_specific_registry.rb +136 -0
  211. data/lib/active_record/type/date.rb +4 -41
  212. data/lib/active_record/type/date_time.rb +4 -38
  213. data/lib/active_record/type/decimal_without_scale.rb +6 -2
  214. data/lib/active_record/type/hash_lookup_type_map.rb +13 -5
  215. data/lib/active_record/type/internal/timezone.rb +17 -0
  216. data/lib/active_record/type/json.rb +30 -0
  217. data/lib/active_record/type/serialized.rb +30 -15
  218. data/lib/active_record/type/text.rb +2 -2
  219. data/lib/active_record/type/time.rb +11 -16
  220. data/lib/active_record/type/type_map.rb +15 -17
  221. data/lib/active_record/type/unsigned_integer.rb +9 -7
  222. data/lib/active_record/type.rb +79 -23
  223. data/lib/active_record/type_caster/connection.rb +33 -0
  224. data/lib/active_record/type_caster/map.rb +23 -0
  225. data/lib/active_record/type_caster.rb +9 -0
  226. data/lib/active_record/validations/absence.rb +25 -0
  227. data/lib/active_record/validations/associated.rb +13 -4
  228. data/lib/active_record/validations/length.rb +26 -0
  229. data/lib/active_record/validations/presence.rb +14 -13
  230. data/lib/active_record/validations/uniqueness.rb +41 -32
  231. data/lib/active_record/validations.rb +38 -35
  232. data/lib/active_record/version.rb +3 -1
  233. data/lib/active_record.rb +36 -21
  234. data/lib/rails/generators/active_record/application_record/application_record_generator.rb +27 -0
  235. data/lib/rails/generators/active_record/application_record/templates/application_record.rb.tt +5 -0
  236. data/lib/rails/generators/active_record/migration/migration_generator.rb +43 -35
  237. data/lib/rails/generators/active_record/migration/templates/{create_table_migration.rb → create_table_migration.rb.tt} +8 -6
  238. data/lib/rails/generators/active_record/migration/templates/{migration.rb → migration.rb.tt} +8 -7
  239. data/lib/rails/generators/active_record/migration.rb +18 -1
  240. data/lib/rails/generators/active_record/model/model_generator.rb +18 -22
  241. data/lib/rails/generators/active_record/model/templates/{model.rb → model.rb.tt} +3 -0
  242. data/lib/rails/generators/active_record.rb +7 -5
  243. metadata +77 -53
  244. data/lib/active_record/associations/preloader/belongs_to.rb +0 -17
  245. data/lib/active_record/associations/preloader/collection_association.rb +0 -24
  246. data/lib/active_record/associations/preloader/has_many.rb +0 -17
  247. data/lib/active_record/associations/preloader/has_many_through.rb +0 -19
  248. data/lib/active_record/associations/preloader/has_one.rb +0 -23
  249. data/lib/active_record/associations/preloader/has_one_through.rb +0 -9
  250. data/lib/active_record/associations/preloader/singular_association.rb +0 -21
  251. data/lib/active_record/attribute.rb +0 -149
  252. data/lib/active_record/attribute_set/builder.rb +0 -86
  253. data/lib/active_record/attribute_set.rb +0 -77
  254. data/lib/active_record/connection_adapters/mysql_adapter.rb +0 -491
  255. data/lib/active_record/connection_adapters/postgresql/array_parser.rb +0 -93
  256. data/lib/active_record/connection_adapters/postgresql/oid/float.rb +0 -21
  257. data/lib/active_record/connection_adapters/postgresql/oid/infinity.rb +0 -13
  258. data/lib/active_record/connection_adapters/postgresql/oid/json.rb +0 -35
  259. data/lib/active_record/connection_adapters/postgresql/oid/time.rb +0 -11
  260. data/lib/active_record/railties/jdbcmysql_error.rb +0 -16
  261. data/lib/active_record/serializers/xml_serializer.rb +0 -193
  262. data/lib/active_record/type/big_integer.rb +0 -13
  263. data/lib/active_record/type/binary.rb +0 -50
  264. data/lib/active_record/type/boolean.rb +0 -30
  265. data/lib/active_record/type/decimal.rb +0 -40
  266. data/lib/active_record/type/decorator.rb +0 -14
  267. data/lib/active_record/type/float.rb +0 -19
  268. data/lib/active_record/type/integer.rb +0 -55
  269. data/lib/active_record/type/mutable.rb +0 -16
  270. data/lib/active_record/type/numeric.rb +0 -36
  271. data/lib/active_record/type/string.rb +0 -36
  272. data/lib/active_record/type/time_value.rb +0 -38
  273. data/lib/active_record/type/value.rb +0 -101
  274. /data/lib/rails/generators/active_record/model/templates/{module.rb → module.rb.tt} +0 -0
data/CHANGELOG.md CHANGED
@@ -1,1372 +1,1084 @@
1
- * Introduce `force: :cascade` option for `create_table`. Using this option
2
- will recreate tables even if they have dependent objects (like foreign keys).
3
- `db/schema.rb` now uses `force: :cascade`. This makes it possible to
4
- reload the schema when foreign keys are in place.
1
+ ## Rails 5.2.8.1 (July 12, 2022) ##
5
2
 
6
- *Matthew Draper*, *Yves Senn*
3
+ * Change ActiveRecord::Coders::YAMLColumn default to safe_load
7
4
 
8
- * `db:schema:load` and `db:structure:load` no longer purge the database
9
- before loading the schema. This is left for the user to do.
10
- `db:test:prepare` will still purge the database.
5
+ This adds two new configuration options The configuration options are as
6
+ follows:
7
+
8
+ * `config.active_storage.use_yaml_unsafe_load`
9
+
10
+ When set to true, this configuration option tells Rails to use the old
11
+ "unsafe" YAML loading strategy, maintaining the existing behavior but leaving
12
+ the possible escalation vulnerability in place. Setting this option to true
13
+ is *not* recommended, but can aid in upgrading.
14
+
15
+ * `config.active_record.yaml_column_permitted_classes`
16
+
17
+ The "safe YAML" loading method does not allow all classes to be deserialized
18
+ by default. This option allows you to specify classes deemed "safe" in your
19
+ application. For example, if your application uses Symbol and Time in
20
+ serialized data, you can add Symbol and Time to the allowed list as follows:
21
+
22
+ ```
23
+ config.active_record.yaml_column_permitted_classes = [Symbol, Date, Time]
24
+ ```
11
25
 
12
- Closes #17945.
26
+ [CVE-2022-32224]
13
27
 
14
- *Yves Senn*
15
28
 
16
- * Fix undesirable RangeError by Type::Integer. Add Type::UnsignedInteger.
29
+ ## Rails 5.2.8 (May 09, 2022) ##
17
30
 
18
- *Ryuta Kamizono*
19
-
20
- * Add `foreign_type` option to `has_one` and `has_many` association macros.
21
-
22
- This option enables to define the column name of associated object's type for polymorphic associations.
23
-
24
- *Ulisses Almeida, Kassio Borges*
25
-
26
- * `add_timestamps` and `remove_timestamps` now properly reversible with
27
- options.
28
-
29
- *Noam Gagliardi-Rabinovich*
30
-
31
- * Bring back `db:test:prepare` to synchronize the test database schema.
32
-
33
- Manual synchronization using `bin/rake db:test:prepare` is required
34
- when a migration is rolled-back, edited and reapplied.
31
+ * No changes.
35
32
 
36
- `ActiveRecord::Base.maintain_test_schema` now uses `db:test:prepare`
37
- to synchronize the schema. Plugins can use this task as a hook to
38
- provide custom behavior after the schema has been loaded.
39
33
 
40
- NOTE: `test:prepare` runs before the schema is synchronized.
34
+ ## Rails 5.2.7.1 (April 26, 2022) ##
41
35
 
42
- Fixes #17171, #15787.
36
+ * No changes.
43
37
 
44
- *Yves Senn*
45
38
 
46
- * Change `reflections` public api to return the keys as String objects.
39
+ ## Rails 5.2.7 (March 10, 2022) ##
47
40
 
48
- Fixes #16928.
41
+ * No changes.
49
42
 
50
- *arthurnn*
51
43
 
52
- * Renaming a table in pg also renames the primary key index.
44
+ ## Rails 5.2.6.3 (March 08, 2022) ##
53
45
 
54
- Fixes #12856
46
+ * No changes.
55
47
 
56
- *Sean Griffin*
57
-
58
- * Make it possible to access fixtures excluded by a `default_scope`.
59
-
60
- *Yves Senn*
61
-
62
- * Fix preloading of associations with a scope containing joins along with
63
- conditions on the joined association.
64
48
 
65
- *Siddharth Sharma*
49
+ ## Rails 5.2.6.2 (February 11, 2022) ##
66
50
 
67
- * Add `Table#name` to match `TableDefinition#name`.
51
+ * No changes.
68
52
 
69
- *Cody Cutrer*
70
53
 
71
- * Cache `CollectionAssociation#reader` proxies separately before and after
72
- the owner has been saved so that the proxy is not cached without the
73
- owner's id.
54
+ ## Rails 5.2.6.1 (February 11, 2022) ##
74
55
 
75
- *Ben Woosley*
56
+ * No changes.
76
57
 
77
- * `ActiveRecord::ReadOnlyRecord` now has a descriptive message.
78
58
 
79
- *Franky W.*
59
+ ## Rails 5.2.6 (May 05, 2021) ##
80
60
 
81
- * Fix preloading of associations which unscope a default scope.
61
+ * No changes.
82
62
 
83
- Fixes #11036.
84
63
 
85
- *Byron Bischoff*
64
+ ## Rails 5.2.5 (March 26, 2021) ##
86
65
 
87
- * Added SchemaDumper support for tables with jsonb columns.
88
-
89
- *Ted O'Meara*
90
-
91
- * Deprecate `sanitize_sql_hash_for_conditions` without replacement. Using a
92
- `Relation` for performing queries and updates is the prefered API.
93
-
94
- *Sean Griffin*
66
+ * No changes.
95
67
 
96
- * Queries now properly type cast values that are part of a join statement,
97
- even when using type decorators such as `serialize`.
98
68
 
99
- *Melanie Gilman & Sean Griffin*
69
+ ## Rails 5.2.4.6 (May 05, 2021) ##
100
70
 
101
- * MySQL enum type lookups, with values matching another type, no longer result
102
- in an endless loop.
71
+ * No changes.
103
72
 
104
- Fixes #17402.
105
73
 
106
- *Yves Senn*
74
+ ## Rails 5.2.4.5 (February 10, 2021) ##
107
75
 
108
- * Raise `ArgumentError` when the body of a scope is not callable.
76
+ * Fix possible DoS vector in PostgreSQL money type
109
77
 
110
- *Mauro George*
78
+ Carefully crafted input can cause a DoS via the regular expressions used
79
+ for validating the money format in the PostgreSQL adapter. This patch
80
+ fixes the regexp.
111
81
 
112
- * Use type column first in multi-column indexes created with `add-reference`.
82
+ Thanks to @dee-see from Hackerone for this patch!
113
83
 
114
- *Derek Prior*
115
-
116
- * Fix `Relation.rewhere` to work with Range values.
117
-
118
- *Dan Olson*
119
-
120
- * `AR::UnknownAttributeError` now includes the class name of a record.
121
-
122
- User.new(name: "Yuki Nishijima", project_attributes: {name: "kaminari"})
123
- # => ActiveRecord::UnknownAttributeError: unknown attribute 'name' for User.
124
-
125
- *Yuki Nishijima*
126
-
127
- * Fix a regression causing `after_create` callbacks to run before associated
128
- records are autosaved.
129
-
130
- Fixes #17209.
131
-
132
- *Agis Anastasopoulos*
133
-
134
- * Honor overridden `rack.test` in Rack environment for the connection
135
- management middleware.
136
-
137
- *Simon Eskildsen*
138
-
139
- * Add a truncate method to the connection.
84
+ [CVE-2021-22880]
140
85
 
141
86
  *Aaron Patterson*
142
87
 
143
- * Don't autosave unchanged has_one through records.
144
-
145
- *Alan Kennedy*, *Steve Parrington*
146
-
147
- * Do not dump foreign keys for ignored tables.
148
-
149
- *Yves Senn*
150
-
151
- * PostgreSQL adapter correctly dumps foreign keys targeting tables
152
- outside the schema search path.
153
-
154
- Fixes #16907.
155
-
156
- *Matthew Draper*, *Yves Senn*
157
-
158
- * When a thread is killed, rollback the active transaction, instead of
159
- committing it during the stack unwind. Previously, we could commit half-
160
- completed work. This fix only works for Ruby 2.0+; on 1.9, we can't
161
- distinguish a thread kill from an ordinary non-local (block) return, so must
162
- default to committing.
163
-
164
- *Chris Hanks*
165
-
166
- * A `NullRelation` should represent nothing. This fixes a bug where
167
- `Comment.where(post_id: Post.none)` returned a non-empty result.
168
-
169
- Fixes #15176.
170
-
171
- *Matthew Draper*, *Yves Senn*
172
-
173
- * Include default column limits in schema.rb. Allows defaults to be changed
174
- in the future without affecting old migrations that assumed old defaults.
175
-
176
- *Jeremy Kemper*
177
-
178
- * MySQL: schema.rb now includes TEXT and BLOB column limits.
179
-
180
- *Jeremy Kemper*
181
-
182
- * MySQL: correct LONGTEXT and LONGBLOB limits from 2GB to their true 4GB.
183
-
184
- *Jeremy Kemper*
185
-
186
- * SQLite3Adapter now checks for views in `table_exists?`. Fixes #14041.
187
-
188
- *Girish Sonawane*
189
-
190
- * Introduce `connection.supports_views?` to check whether the current adapter
191
- has support for SQL views. Connection adapters should define this method.
192
-
193
- *Yves Senn*
194
-
195
- * Allow included modules to override association methods.
196
-
197
- Fixes #16684.
198
-
199
- *Yves Senn*
200
-
201
- * Schema loading rake tasks (like `db:schema:load` and `db:setup`) maintain
202
- the database connection to the current environment.
203
-
204
- Fixes #16757.
205
-
206
- *Joshua Cody*, *Yves Senn*
207
-
208
- * MySQL: set the connection collation along with the charset.
209
-
210
- Sets the connection collation to the database collation configured in
211
- database.yml. Otherwise, `SET NAMES utf8mb4` will use the default
212
- collation for that charset (utf8mb4_general_ci) when you may have chosen
213
- a different collation, like utf8mb4_unicode_ci.
214
-
215
- This only applies to literal string comparisons, not column values, so it
216
- is unlikely to affect you.
217
-
218
- *Jeremy Kemper*
219
-
220
- * `default_sequence_name` from the PostgreSQL adapter returns a `String`.
221
-
222
- *Yves Senn*
223
-
224
- * Fix a regression where whitespaces were stripped from DISTINCT queries in
225
- PostgreSQL.
226
-
227
- *Agis Anastasopoulos*
228
88
 
229
- Fixes #16623.
89
+ ## Rails 5.2.4.4 (September 09, 2020) ##
230
90
 
231
- * Fix has_many :through relation merging failing when dynamic conditions are
232
- passed as a lambda with an arity of one.
91
+ * No changes.
233
92
 
234
- Fixes #16128.
235
93
 
236
- *Agis Anastasopoulos*
94
+ ## Rails 5.2.4.3 (May 18, 2020) ##
237
95
 
238
- * Fix `Relation#exists?` to work with polymorphic associations.
96
+ * No changes.
239
97
 
240
- Fixes #15821.
98
+ ## Rails 5.2.4.2 (March 19, 2020) ##
241
99
 
242
- *Kassio Borges*
100
+ * No changes.
243
101
 
244
- * Currently, Active Record rescues any errors raised within
245
- `after_rollback`/`after_create` callbacks and prints them to the logs.
246
- Future versions of Rails will not rescue these errors anymore and
247
- just bubble them up like the other callbacks.
248
102
 
249
- This commit adds an opt-in flag to enable not rescuing the errors.
103
+ ## Rails 5.2.4.1 (December 18, 2019) ##
250
104
 
251
- Example:
252
-
253
- # Do not swallow errors in after_commit/after_rollback callbacks.
254
- config.active_record.raise_in_transactional_callbacks = true
255
-
256
- Fixes #13460.
257
-
258
- *arthurnn*
259
-
260
- * Fix an issue where custom accessor methods (such as those generated by
261
- `enum`) with the same name as a global method are incorrectly overridden
262
- when subclassing.
263
-
264
- Fixes #16288.
265
-
266
- *Godfrey Chan*
267
-
268
- * `*_was` and `changes` now work correctly for in-place attribute changes as
269
- well.
270
-
271
- *Sean Griffin*
272
-
273
- * Fix regression on `after_commit` that did not fire with nested transactions.
274
-
275
- Fixes #16425.
276
-
277
- *arthurnn*
278
-
279
- * Do not try to write timestamps when a table has no timestamps columns.
280
-
281
- Fixes #8813.
282
-
283
- *Sergey Potapov*
284
-
285
- * `index_exists?` with `:name` option does verify specified columns.
286
-
287
- Example:
288
-
289
- add_index :articles, :title, name: "idx_title"
290
-
291
- # Before:
292
- index_exists? :articles, :title, name: "idx_title" # => `true`
293
- index_exists? :articles, :body, name: "idx_title" # => `true`
294
-
295
- # After:
296
- index_exists? :articles, :title, name: "idx_title" # => `true`
297
- index_exists? :articles, :body, name: "idx_title" # => `false`
298
-
299
- *Yves Senn*, *Matthew Draper*
300
-
301
- * `add_timestamps` and `t.timestamps` now require you to pass the `:null` option.
302
- Not passing the option is deprecated but the default is still `null: true`.
303
- With Rails 5 this will change to `null: false`.
304
-
305
- *Sean Griffin*
306
-
307
- * When calling `update_columns` on a record that is not persisted, the error
308
- message now reflects whether that object is a new record or has been
309
- destroyed.
310
-
311
- *Lachlan Sylvester*
312
-
313
- * Define `id_was` to get the previous value of the primary key.
314
-
315
- Currently when we call `id_was` and we have a custom primary key name,
316
- Active Record will return the current value of the primary key. This
317
- makes it impossible to correctly do an update operation if you change the
318
- id.
319
-
320
- Fixes #16413.
105
+ * No changes.
321
106
 
322
- *Rafael Mendonça França*
323
-
324
- * Deprecate `DatabaseTasks.load_schema` to act on the current connection.
325
- Use `.load_schema_current` instead. In the future `load_schema` will
326
- require the `configuration` to act on as an argument.
327
-
328
- *Yves Senn*
329
-
330
- * Fix automatic maintaining test schema to properly handle sql structure
331
- schema format.
332
107
 
333
- Fixes #15394.
108
+ ## Rails 5.2.4 (November 27, 2019) ##
334
109
 
335
- *Wojciech Wnętrzak*
110
+ * Fix circular `autosave: true` causes invalid records to be saved.
336
111
 
337
- * Fix type casting to Decimal from Float with large precision.
112
+ Prior to the fix, when there was a circular series of `autosave: true`
113
+ associations, the callback for a `has_many` association was run while
114
+ another instance of the same callback on the same association hadn't
115
+ finished running. When control returned to the first instance of the
116
+ callback, the instance variable had changed, and subsequent associated
117
+ records weren't saved correctly. Specifically, the ID field for the
118
+ `belongs_to` corresponding to the `has_many` was `nil`.
338
119
 
339
- *Tomohiro Hashidate*
120
+ Fixes #28080.
340
121
 
341
- * Deprecate `Reflection#source_macro`
122
+ *Larry Reid*
342
123
 
343
- `Reflection#source_macro` is no longer needed in Active Record
344
- source so it has been deprecated. Code that used `source_macro`
345
- was removed in #16353.
124
+ * PostgreSQL: Fix GROUP BY with ORDER BY virtual count attribute.
346
125
 
347
- *Eileen M. Uchtitelle*, *Aaron Patterson*
126
+ Fixes #36022.
348
127
 
349
- * No verbose backtrace by `db:drop` when database does not exist.
350
-
351
- Fixes #16295.
128
+ *Ryuta Kamizono*
352
129
 
353
- *Kenn Ejima*
130
+ * Fix sqlite3 collation parsing when using decimal columns.
354
131
 
355
- * Add support for PostgreSQL JSONB.
132
+ *Martin R. Schuster*
356
133
 
357
- Example:
134
+ * Make ActiveRecord `ConnectionPool.connections` method thread-safe.
358
135
 
359
- create_table :posts do |t|
360
- t.jsonb :meta_data
361
- end
136
+ Fixes #36465.
362
137
 
363
- *Philippe Creux*, *Chris Teague*
138
+ *Jeff Doering*
364
139
 
365
- * `db:purge` with MySQL respects `Rails.env`.
140
+ * Assign all attributes before calling `build` to ensure the child record is visible in
141
+ `before_add` and `after_add` callbacks for `has_many :through` associations.
366
142
 
367
- *Yves Senn*
143
+ Fixes #33249.
368
144
 
369
- * `change_column_default :table, :column, nil` with PostgreSQL will issue a
370
- `DROP DEFAULT` instead of a `DEFAULT NULL` query.
145
+ *Ryan H. Kerr*
371
146
 
372
- Fixes #16261.
373
147
 
374
- *Matthew Draper*, *Yves Senn*
148
+ ## Rails 5.2.3 (March 27, 2019) ##
375
149
 
376
- * Allow to specify a type for the foreign key column in `references`
377
- and `add_reference`.
150
+ * Fix different `count` calculation when using `size` with manual `select` with DISTINCT.
378
151
 
379
- Example:
152
+ Fixes #35214.
380
153
 
381
- change_table :vehicle do |t|
382
- t.references :station, type: :uuid
383
- end
154
+ *Juani Villarejo*
384
155
 
385
- *Andrey Novikov*, *Łukasz Sarnacki*
156
+ * Fix prepared statements caching to be enabled even when query caching is enabled.
386
157
 
387
- * `create_join_table` removes a common prefix when generating the join table.
388
- This matches the existing behavior of HABTM associations.
158
+ *Ryuta Kamizono*
389
159
 
390
- Fixes #13683.
160
+ * Don't allow `where` with invalid value matches to nil values.
391
161
 
392
- *Stefan Kanev*
162
+ Fixes #33624.
393
163
 
394
- * Do not swallow errors on `compute_type` when having a bad `alias_method` on
395
- a class.
164
+ *Ryuta Kamizono*
396
165
 
397
- *arthurnn*
166
+ * Restore an ability that class level `update` without giving ids.
398
167
 
399
- * PostgreSQL invalid `uuid` are convert to nil.
168
+ Fixes #34743.
400
169
 
401
- *Abdelkader Boudih*
170
+ *Ryuta Kamizono*
402
171
 
403
- * Restore 4.0 behavior for using serialize attributes with `JSON` as coder.
172
+ * Fix join table column quoting with SQLite.
404
173
 
405
- With 4.1.x, `serialize` started returning a string when `JSON` was passed as
406
- the second attribute. It will now return a hash as per previous versions.
174
+ *Gannon McGibbon*
407
175
 
408
- Example:
176
+ * Ensure that `delete_all` on collection proxy returns affected count.
409
177
 
410
- class Post < ActiveRecord::Base
411
- serialize :comment, JSON
412
- end
413
-
414
- class Comment
415
- include ActiveModel::Model
416
- attr_accessor :category, :text
417
- end
418
-
419
- post = Post.create!
420
- post.comment = Comment.new(category: "Animals", text: "This is a comment about squirrels.")
421
- post.save!
178
+ *Ryuta Kamizono*
422
179
 
423
- # 4.0
424
- post.comment # => {"category"=>"Animals", "text"=>"This is a comment about squirrels."}
180
+ * Reset scope after delete on collection association to clear stale offsets of removed records.
425
181
 
426
- # 4.1 before
427
- post.comment # => "#<Comment:0x007f80ab48ff98>"
182
+ *Gannon McGibbon*
428
183
 
429
- # 4.1 after
430
- post.comment # => {"category"=>"Animals", "text"=>"This is a comment about squirrels."}
431
184
 
432
- When using `JSON` as the coder in `serialize`, Active Record will use the
433
- new `ActiveRecord::Coders::JSON` coder which delegates its `dump/load` to
434
- `ActiveSupport::JSON.encode/decode`. This ensures special objects are dumped
435
- correctly using the `#as_json` hook.
185
+ ## Rails 5.2.2.1 (March 11, 2019) ##
436
186
 
437
- To keep the previous behaviour, supply a custom coder instead
438
- ([example](https://gist.github.com/jenncoop/8c4142bbe59da77daa63)).
187
+ * No changes.
439
188
 
440
- Fixes #15594.
441
189
 
442
- *Jenn Cooper*
190
+ ## Rails 5.2.2 (December 04, 2018) ##
443
191
 
444
- * Do not use `RENAME INDEX` syntax for MariaDB 10.0.
192
+ * Do not ignore the scoping with query methods in the scope block.
445
193
 
446
- Fixes #15931.
194
+ *Ryuta Kamizono*
447
195
 
448
- *Jeff Browning*
196
+ * Allow aliased attributes to be used in `#update_columns` and `#update`.
449
197
 
450
- * Calling `#empty?` on a `has_many` association would use the value from the
451
- counter cache if one exists.
198
+ *Gannon McGibbon*
452
199
 
453
- *David Verhasselt*
200
+ * Allow spaces in postgres table names.
454
201
 
455
- * Fix the schema dump generated for tables without constraints and with
456
- primary key with default value of custom PostgreSQL function result.
202
+ Fixes issue where "user post" is misinterpreted as "\"user\".\"post\"" when quoting table names with the postgres
203
+ adapter.
457
204
 
458
- Fixes #16111.
205
+ *Gannon McGibbon*
459
206
 
460
- *Andrey Novikov*
207
+ * Cached columns_hash fields should be excluded from ResultSet#column_types
461
208
 
462
- * Fix the SQL generated when a `delete_all` is run on an association to not
463
- produce an `IN` statements.
209
+ PR #34528 addresses the inconsistent behaviour when attribute is defined for an ignored column. The following test
210
+ was passing for SQLite and MySQL, but failed for PostgreSQL:
464
211
 
465
- Before:
212
+ ```ruby
213
+ class DeveloperName < ActiveRecord::Type::String
214
+ def deserialize(value)
215
+ "Developer: #{value}"
216
+ end
217
+ end
466
218
 
467
- UPDATE "categorizations" SET "category_id" = NULL WHERE
468
- "categorizations"."category_id" = 1 AND "categorizations"."id" IN (1, 2)
219
+ class AttributedDeveloper < ActiveRecord::Base
220
+ self.table_name = "developers"
469
221
 
470
- After:
222
+ attribute :name, DeveloperName.new
471
223
 
472
- UPDATE "categorizations" SET "category_id" = NULL WHERE
473
- "categorizations"."category_id" = 1
224
+ self.ignored_columns += ["name"]
225
+ end
474
226
 
475
- *Eileen M. Uchitelle, Aaron Patterson*
227
+ developer = AttributedDeveloper.create
228
+ developer.update_column :name, "name"
476
229
 
477
- * Avoid type casting boolean and `ActiveSupport::Duration` values to numeric
478
- values for string columns. Otherwise, in some database, the string column
479
- values will be coerced to a numeric allowing false or 0.seconds match any
480
- string starting with a non-digit.
230
+ loaded_developer = AttributedDeveloper.where(id: developer.id).select("*").first
231
+ puts loaded_developer.name # should be "Developer: name" but it's just "name"
232
+ ```
481
233
 
482
- Example:
234
+ *Dmitry Tsepelev*
483
235
 
484
- App.where(apikey: false) # => SELECT * FROM users WHERE apikey = '0'
236
+ * Values of enum are frozen, raising an error when attempting to modify them.
485
237
 
486
- *Dylan Thacker-Smith*
238
+ *Emmanuel Byrd*
487
239
 
488
- * Add a `:required` option to singular associations, providing a nicer
489
- API for presence validations on associations.
240
+ * `update_columns` now correctly raises `ActiveModel::MissingAttributeError`
241
+ if the attribute does not exist.
490
242
 
491
243
  *Sean Griffin*
492
244
 
493
- * Fix an error in `reset_counters` when associations have `select` scope.
494
- (Call to `count` generated invalid SQL.)
495
-
496
- *Cade Truitt*
497
-
498
- * After a successful `reload`, `new_record?` is always false.
499
-
500
- Fixes #12101.
501
-
502
- *Matthew Draper*
503
-
504
- * PostgreSQL renaming table doesn't attempt to rename non existent sequences.
505
-
506
- *Abdelkader Boudih*
507
-
508
- * Move 'dependent: :destroy' handling for `belongs_to`
509
- from `before_destroy` to `after_destroy` callback chain
245
+ * Do not use prepared statement in queries that have a large number of binds.
510
246
 
511
- Fixes #12380.
512
-
513
- *Ivan Antropov*
514
-
515
- * Detect in-place modifications on String attributes.
516
-
517
- Before this change, an attribute modified in-place had to be marked as
518
- changed in order for it to be persisted in the database. Now it is no longer
519
- required.
520
-
521
- Before:
522
-
523
- user = User.first
524
- user.name << ' Griffin'
525
- user.name_will_change!
526
- user.save
527
- user.reload.name # => "Sean Griffin"
528
-
529
- After:
530
-
531
- user = User.first
532
- user.name << ' Griffin'
533
- user.save
534
- user.reload.name # => "Sean Griffin"
535
-
536
- *Sean Griffin*
247
+ *Ryuta Kamizono*
537
248
 
538
- * Add `ActiveRecord::Base#validate!` that raises `RecordInvalid` if the record
539
- is invalid.
249
+ * Fix query cache to load before first request.
540
250
 
541
- *Bogdan Gusiev*, *Marc Schütz*
251
+ *Eileen M. Uchitelle*
542
252
 
543
- * Support for adding and removing foreign keys. Foreign keys are now
544
- a part of `schema.rb`. This is supported by Mysql2Adapter, MysqlAdapter
545
- and PostgreSQLAdapter.
253
+ * Fix collection cache key with limit and custom select to avoid ambiguous timestamp column error.
546
254
 
547
- Many thanks to *Matthew Higgins* for laying the foundation with his work on
548
- [foreigner](https://github.com/matthuhiggins/foreigner).
255
+ Fixes #33056.
549
256
 
550
- Example:
257
+ *Federico Martinez*
551
258
 
552
- # within your migrations:
553
- add_foreign_key :articles, :authors
554
- remove_foreign_key :articles, :authors
259
+ * Fix duplicated record creation when using nested attributes with `create_with`.
555
260
 
556
- *Yves Senn*
261
+ *Darwin Wu*
557
262
 
558
- * Fix subtle bugs regarding attribute assignment on models with no primary
559
- key. `'id'` will no longer be part of the attributes hash.
263
+ * Fix regression setting children record in parent `before_save` callback.
560
264
 
561
- *Sean Griffin*
265
+ *Guo Xiang Tan*
562
266
 
563
- * Deprecate automatic counter caches on `has_many :through`. The behavior was
564
- broken and inconsistent.
267
+ * Prevent leaking of user's DB credentials on `rails db:create` failure.
565
268
 
566
- *Sean Griffin*
269
+ *bogdanvlviv*
567
270
 
568
- * `preload` preserves readonly flag for associations.
271
+ * Clear mutation tracker before continuing the around callbacks.
569
272
 
570
- See #15853.
273
+ *Yuya Tanaka*
571
274
 
572
- *Yves Senn*
275
+ * Prevent deadlocks when waiting for connection from pool.
573
276
 
574
- * Assume numeric types have changed if they were assigned to a value that
575
- would fail numericality validation, regardless of the old value. Previously
576
- this would only occur if the old value was 0.
277
+ *Brent Wheeldon*
577
278
 
578
- Example:
279
+ * Avoid extra scoping when using `Relation#update` that was causing this method to change the current scope.
579
280
 
580
- model = Model.create!(number: 5)
581
- model.number = '5wibble'
582
- model.number_changed? # => true
281
+ *Ryuta Kamizono*
583
282
 
584
- Fixes #14731.
283
+ * Fix numericality validator not to be affected by custom getter.
585
284
 
586
- *Sean Griffin*
285
+ *Ryuta Kamizono*
587
286
 
588
- * `reload` no longer merges with the existing attributes.
589
- The attribute hash is fully replaced. The record is put into the same state
590
- as it would be with `Model.find(model.id)`.
287
+ * Fix bulk change table ignores comment option on PostgreSQL.
591
288
 
592
- *Sean Griffin*
289
+ *Yoshiyuki Kinjo*
593
290
 
594
- * The object returned from `select_all` must respond to `column_types`.
595
- If this is not the case a `NoMethodError` is raised.
596
291
 
597
- *Sean Griffin*
292
+ ## Rails 5.2.1.1 (November 27, 2018) ##
598
293
 
599
- * Detect in-place modifications of PG array types
294
+ * No changes.
600
295
 
601
- *Sean Griffin*
602
296
 
603
- * Add `bin/rake db:purge` task to empty the current database.
297
+ ## Rails 5.2.1 (August 07, 2018) ##
604
298
 
605
- *Yves Senn*
299
+ * PostgreSQL: Support new relkind for partitioned tables.
606
300
 
607
- * Deprecate `serialized_attributes` without replacement.
301
+ Fixes #33008.
608
302
 
609
- *Sean Griffin*
303
+ *Yannick Schutz*
610
304
 
611
- * Correctly extract IPv6 addresses from `DATABASE_URI`: the square brackets
612
- are part of the URI structure, not the actual host.
305
+ * Rollback parent transaction when children fails to update.
613
306
 
614
- Fixes #15705.
307
+ *Guillaume Malette*
615
308
 
616
- *Andy Bakun*, *Aaron Stone*
309
+ * Fix default value for MySQL time types with specified precision.
617
310
 
618
- * Ensure both parent IDs are set on join records when both sides of a
619
- through association are new.
311
+ *Nikolay Kondratyev*
620
312
 
621
- *Sean Griffin*
313
+ * Fix `touch` option to behave consistently with `Persistence#touch` method.
622
314
 
623
- * `ActiveRecord::Dirty` now detects in-place changes to mutable values.
624
- Serialized attributes on ActiveRecord models will no longer save when
625
- unchanged.
315
+ *Ryuta Kamizono*
626
316
 
627
- Fixes #8328.
317
+ * Fix `save` in `after_create_commit` won't invoke extra `after_create_commit`.
628
318
 
629
- *Sean Griffin*
319
+ Fixes #32831.
630
320
 
631
- * `Pluck` now works when selecting columns from different tables with the same
632
- name.
321
+ *Ryuta Kamizono*
633
322
 
634
- Fixes #15649.
323
+ * Fix logic on disabling commit callbacks so they are not called unexpectedly when errors occur.
635
324
 
636
- *Sean Griffin*
325
+ *Brian Durand*
637
326
 
638
- * Remove `cache_attributes` and friends. All attributes are cached.
327
+ * Fix parent record should not get saved with duplicate children records.
639
328
 
640
- *Sean Griffin*
329
+ Fixes #32940.
641
330
 
642
- * Remove deprecated method `ActiveRecord::Base.quoted_locking_column`.
331
+ *Santosh Wadghule*
643
332
 
644
- *Akshay Vishnoi*
333
+ * Fix that association's after_touch is not called with counter cache.
645
334
 
646
- * `ActiveRecord::FinderMethods.find` with block can handle proc parameter as
647
- `Enumerable#find` does.
335
+ Fixes #31559.
648
336
 
649
- Fixes #15382.
337
+ *Ryuta Kamizono*
650
338
 
651
- *James Yang*
339
+ * `becomes` should clear the mutation tracker which is created in `after_initialize`.
652
340
 
653
- * Make timezone aware attributes work with PostgreSQL array columns.
341
+ Fixes #32867.
654
342
 
655
- Fixes #13402.
343
+ *Ryuta Kamizono*
656
344
 
657
- *Kuldeep Aggarwal*, *Sean Griffin*
345
+ * Allow a belonging to parent object to be created from a new record.
658
346
 
659
- * `ActiveRecord::SchemaMigration` has no primary key regardless of the
660
- `primary_key_prefix_type` configuration.
347
+ *Jolyon Pawlyn*
661
348
 
662
- Fixes #15051.
349
+ * Fix that building record with assigning multiple has_one associations
350
+ wrongly persists through record.
663
351
 
664
- *JoseLuis Torres*, *Yves Senn*
352
+ Fixes #32511.
665
353
 
666
- * `rake db:migrate:status` works with legacy migration numbers like `00018_xyz.rb`.
354
+ *Sam DeCesare*
667
355
 
668
- Fixes #15538.
356
+ * Fix relation merging when one of the relations is going to skip the
357
+ query cache.
669
358
 
670
- *Yves Senn*
359
+ *James Williams*
671
360
 
672
- * Baseclass becomes! subclass.
673
361
 
674
- Before this change, a record which changed its STI type, could not be
675
- updated.
362
+ ## Rails 5.2.0 (April 09, 2018) ##
676
363
 
677
- Fixes #14785.
364
+ * MySQL: Support mysql2 0.5.x.
678
365
 
679
- *Matthew Draper*, *Earl St Sauver*, *Edo Balvers*
366
+ *Aaron Stone*
680
367
 
681
- * Remove deprecated `ActiveRecord::Migrator.proper_table_name`. Use the
682
- `proper_table_name` instance method on `ActiveRecord::Migration` instead.
368
+ * Apply time column precision on assignment.
683
369
 
684
- *Akshay Vishnoi*
370
+ PR #20317 changed the behavior of datetime columns so that when they
371
+ have a specified precision then on assignment the value is rounded to
372
+ that precision. This behavior is now applied to time columns as well.
685
373
 
686
- * Fix regression on eager loading association based on SQL query rather than
687
- existing column.
374
+ Fixes #30301.
688
375
 
689
- Fixes #15480.
376
+ *Andrew White*
690
377
 
691
- *Lauro Caetano*, *Carlos Antonio da Silva*
378
+ * Normalize time column values for SQLite database.
692
379
 
693
- * Deprecate returning `nil` from `column_for_attribute` when no column exists.
694
- It will return a null object in Rails 5.0
380
+ For legacy reasons, time columns in SQLite are stored as full datetimes
381
+ because until #24542 the quoting for time columns didn't remove the date
382
+ component. To ensure that values are consistent we now normalize the
383
+ date component to 2001-01-01 on reading and writing.
695
384
 
696
- *Sean Griffin*
385
+ *Andrew White*
697
386
 
698
- * Implemented `ActiveRecord::Base#pretty_print` to work with PP.
387
+ * Ensure that the date component is removed when quoting times.
699
388
 
700
- *Ethan*
389
+ PR #24542 altered the quoting for time columns so that the date component
390
+ was removed however it only removed it when it was 2001-01-01. Now the
391
+ date component is removed irrespective of what the date is.
701
392
 
702
- * Preserve type when dumping PostgreSQL point, bit, bit varying and money
703
- columns.
393
+ *Andrew White*
704
394
 
705
- *Yves Senn*
395
+ * Fix `dependent: :destroy` issue for has_one/belongs_to relationship where
396
+ the parent class was getting deleted when the child was not.
706
397
 
707
- * New records remain new after YAML serialization.
398
+ Fixes #32022.
708
399
 
709
- *Sean Griffin*
400
+ *Fernando Gorodscy*
710
401
 
711
- * PostgreSQL support default values for enum types. Fixes #7814.
402
+ * Whitelist `NULLS FIRST` and `NULLS LAST` in order clauses too.
712
403
 
713
- *Yves Senn*
404
+ *Xavier Noria*
714
405
 
715
- * PostgreSQL `default_sequence_name` respects schema. Fixes #7516.
406
+ * Fix that after commit callbacks on update does not triggered when optimistic locking is enabled.
716
407
 
717
- *Yves Senn*
408
+ *Ryuta Kamizono*
718
409
 
719
- * Fix `columns_for_distinct` of PostgreSQL adapter to work correctly
720
- with orders without sort direction modifiers.
410
+ * Fix `#columns_for_distinct` of MySQL and PostgreSQL to make
411
+ `ActiveRecord::FinderMethods#limited_ids_for` use correct primary key values
412
+ even if `ORDER BY` columns include other table's primary key.
721
413
 
722
- *Nikolay Kondratyev*
414
+ Fixes #28364.
723
415
 
724
- * PostgreSQL `reset_pk_sequence!` respects schemas. Fixes #14719.
416
+ *Takumi Kagiyama*
725
417
 
726
- *Yves Senn*
418
+ * Make `reflection.klass` raise if `polymorphic?` not to be misused.
727
419
 
728
- * Keep PostgreSQL `hstore` and `json` attributes as `Hash` in `@attributes`.
729
- Fixes duplication in combination with `store_accessor`.
420
+ Fixes #31876.
730
421
 
731
- Fixes #15369.
422
+ *Ryuta Kamizono*
732
423
 
733
- *Yves Senn*
424
+ * PostgreSQL: Allow pg-1.0 gem to be used with Active Record.
734
425
 
735
- * `rake railties:install:migrations` respects the order of railties.
426
+ *Lars Kanis*
736
427
 
737
- *Arun Agrawal*
428
+ * Deprecate `expand_hash_conditions_for_aggregates` without replacement.
429
+ Using a `Relation` for performing queries is the prefered API.
738
430
 
739
- * Fix redefine a `has_and_belongs_to_many` inside inherited class
740
- Fixing regression case, where redefining the same `has_and_belongs_to_many`
741
- definition into a subclass would raise.
431
+ *Ryuta Kamizono*
742
432
 
743
- Fixes #14983.
433
+ * Fix not expanded problem when passing an Array object as argument to the where method using `composed_of` column.
744
434
 
745
- *arthurnn*
435
+ ```
436
+ david_balance = customers(:david).balance
437
+ Customer.where(balance: [david_balance]).to_sql
746
438
 
747
- * Fix `has_and_belongs_to_many` public reflection.
748
- When defining a `has_and_belongs_to_many`, internally we convert that to two has_many.
749
- But as `reflections` is a public API, people expect to see the right macro.
439
+ # Before: WHERE `customers`.`balance` = NULL
440
+ # After : WHERE `customers`.`balance` = 50
441
+ ```
750
442
 
751
- Fixes #14682.
443
+ Fixes #31723.
752
444
 
753
- *arthurnn*
445
+ *Yutaro Kanagawa*
754
446
 
755
- * Fix serialization for records with an attribute named `format`.
447
+ * Fix `count(:all)` with eager loading and having an order other than the driving table.
756
448
 
757
- Fixes #15188.
449
+ Fixes #31783.
758
450
 
759
- *Godfrey Chan*
451
+ *Ryuta Kamizono*
760
452
 
761
- * When a `group` is set, `sum`, `size`, `average`, `minimum` and `maximum`
762
- on a NullRelation should return a Hash.
453
+ * Clear the transaction state when an Active Record object is duped.
763
454
 
764
- *Kuldeep Aggarwal*
455
+ Fixes #31670.
765
456
 
766
- * Fix serialized fields returning serialized data after being updated with
767
- `update_column`.
457
+ *Yuriy Ustushenko*
768
458
 
769
- *Simon Hørup Eskildsen*
459
+ * Support for PostgreSQL foreign tables.
770
460
 
771
- * Fix polymorphic eager loading when using a String as foreign key.
461
+ *fatkodima*
772
462
 
773
- Fixes #14734.
463
+ * Fix relation merger issue with `left_outer_joins`.
774
464
 
775
- *Lauro Caetano*
465
+ *Mehmet Emin İNAÇ*
776
466
 
777
- * Change belongs_to touch to be consistent with timestamp updates
467
+ * Don't allow destroyed object mutation after `save` or `save!` is called.
778
468
 
779
- If a model is set up with a belongs_to: touch relationship the parent
780
- record will only be touched if the record was modified. This makes it
781
- consistent with timestamp updating on the record itself.
469
+ *Ryuta Kamizono*
782
470
 
783
- *Brock Trappitt*
471
+ * Take into account association conditions when deleting through records.
784
472
 
785
- * Fix the inferred table name of a `has_and_belongs_to_many` auxiliary
786
- table inside a schema.
473
+ Fixes #18424.
787
474
 
788
- Fixes #14824.
475
+ *Piotr Jakubowski*
789
476
 
790
- *Eric Chahin*
477
+ * Fix nested `has_many :through` associations on unpersisted parent instances.
791
478
 
792
- * Remove unused `:timestamp` type. Transparently alias it to `:datetime`
793
- in all cases. Fixes inconsistencies when column types are sent outside of
794
- `ActiveRecord`, such as for XML Serialization.
479
+ For example, if you have
795
480
 
796
- *Sean Griffin*
481
+ class Post < ActiveRecord::Base
482
+ belongs_to :author
483
+ has_many :books, through: :author
484
+ has_many :subscriptions, through: :books
485
+ end
797
486
 
798
- * Fix bug that added `table_name_prefix` and `table_name_suffix` to
799
- extension names in PostgreSQL when migrating.
487
+ class Author < ActiveRecord::Base
488
+ has_one :post
489
+ has_many :books
490
+ has_many :subscriptions, through: :books
491
+ end
800
492
 
801
- *Joao Carlos*
493
+ class Book < ActiveRecord::Base
494
+ belongs_to :author
495
+ has_many :subscriptions
496
+ end
802
497
 
803
- * The `:index` option in migrations, which previously was only available for
804
- `references`, now works with any column types.
498
+ class Subscription < ActiveRecord::Base
499
+ belongs_to :book
500
+ end
805
501
 
806
- *Marc Schütz*
502
+ Before:
807
503
 
808
- * Add support for counter name to be passed as parameter on `CounterCache::ClassMethods#reset_counters`.
504
+ If `post` is not persisted, then `post.subscriptions` will be empty.
809
505
 
810
- *jnormore*
506
+ After:
811
507
 
812
- * Restrict deletion of record when using `delete_all` with `uniq`, `group`, `having`
813
- or `offset`.
508
+ If `post` is not persisted, then `post.subscriptions` can be set and used
509
+ just like it would if `post` were persisted.
814
510
 
815
- In these cases the generated query ignored them and that caused unintended
816
- records to be deleted.
511
+ Fixes #16313.
817
512
 
818
- Fixes #11985.
513
+ *Zoltan Kiss*
819
514
 
820
- *Leandro Facchinetti*
515
+ * Fixed inconsistency with `first(n)` when used with `limit()`.
516
+ The `first(n)` finder now respects the `limit()`, making it consistent
517
+ with `relation.to_a.first(n)`, and also with the behavior of `last(n)`.
821
518
 
822
- * Floats with limit >= 25 that get turned into doubles in MySQL no longer have
823
- their limit dropped from the schema.
519
+ Fixes #23979.
824
520
 
825
- Fixes #14135.
521
+ *Brian Christian*
826
522
 
827
- *Aaron Nelson*
523
+ * Use `count(:all)` in `HasManyAssociation#count_records` to prevent invalid
524
+ SQL queries for association counting.
828
525
 
829
- * Fix how to calculate associated class name when using namespaced `has_and_belongs_to_many`
830
- association.
526
+ *Klas Eskilson*
831
527
 
832
- Fixes #14709.
528
+ * Fix to invoke callbacks when using `update_attribute`.
833
529
 
834
- *Kassio Borges*
530
+ *Mike Busch*
835
531
 
836
- * `ActiveRecord::Relation::Merger#filter_binds` now compares equivalent symbols and
837
- strings in column names as equal.
532
+ * Fix `count(:all)` to correctly work `distinct` with custom SELECT list.
838
533
 
839
- This fixes a rare case in which more bind values are passed than there are
840
- placeholders for them in the generated SQL statement, which can make PostgreSQL
841
- throw a `StatementInvalid` exception.
534
+ *Ryuta Kamizono*
842
535
 
843
- *Nat Budin*
536
+ * Using subselect for `delete_all` with `limit` or `offset`.
844
537
 
845
- * Fix `stored_attributes` to correctly merge the details of stored
846
- attributes defined in parent classes.
538
+ *Ryuta Kamizono*
847
539
 
848
- Fixes #14672.
540
+ * Undefine attribute methods on descendants when resetting column
541
+ information.
849
542
 
850
- *Brad Bennett*, *Jessica Yao*, *Lakshmi Parthasarathy*
543
+ *Chris Salzberg*
851
544
 
852
- * `change_column_default` allows `[]` as argument to `change_column_default`.
545
+ * Log database query callers.
853
546
 
854
- Fixes #11586.
547
+ Add `verbose_query_logs` configuration option to display the caller
548
+ of database queries in the log to facilitate N+1 query resolution
549
+ and other debugging.
855
550
 
856
- *Yves Senn*
551
+ Enabled in development only for new and upgraded applications. Not
552
+ recommended for use in the production environment since it relies
553
+ on Ruby's `Kernel#caller_locations` which is fairly slow.
857
554
 
858
- * Handle `name` and `"char"` column types in the PostgreSQL adapter.
555
+ *Olivier Lacan*
859
556
 
860
- `name` and `"char"` are special character types used internally by
861
- PostgreSQL and are used by internal system catalogs. These field types
862
- can sometimes show up in structure-sniffing queries that feature internal system
863
- structures or with certain PostgreSQL extensions.
557
+ * Fix conflicts `counter_cache` with `touch: true` by optimistic locking.
864
558
 
865
- *J Smith*, *Yves Senn*
559
+ ```
560
+ # create_table :posts do |t|
561
+ # t.integer :comments_count, default: 0
562
+ # t.integer :lock_version
563
+ # t.timestamps
564
+ # end
565
+ class Post < ApplicationRecord
566
+ end
866
567
 
867
- * Fix `PostgreSQLAdapter::OID::Float#type_cast` to convert Infinity and
868
- NaN PostgreSQL values into a native Ruby `Float::INFINITY` and `Float::NAN`
568
+ # create_table :comments do |t|
569
+ # t.belongs_to :post
570
+ # end
571
+ class Comment < ApplicationRecord
572
+ belongs_to :post, touch: true, counter_cache: true
573
+ end
574
+ ```
869
575
 
870
576
  Before:
871
-
872
- Point.create(value: 1.0/0)
873
- Point.last.value # => 0.0
577
+ ```
578
+ post = Post.create!
579
+ # => begin transaction
580
+ INSERT INTO "posts" ("created_at", "updated_at", "lock_version")
581
+ VALUES ("2017-12-11 21:27:11.387397", "2017-12-11 21:27:11.387397", 0)
582
+ commit transaction
583
+
584
+ comment = Comment.create!(post: post)
585
+ # => begin transaction
586
+ INSERT INTO "comments" ("post_id") VALUES (1)
587
+
588
+ UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1,
589
+ "lock_version" = COALESCE("lock_version", 0) + 1 WHERE "posts"."id" = 1
590
+
591
+ UPDATE "posts" SET "updated_at" = '2017-12-11 21:27:11.398330',
592
+ "lock_version" = 1 WHERE "posts"."id" = 1 AND "posts"."lock_version" = 0
593
+ rollback transaction
594
+ # => ActiveRecord::StaleObjectError: Attempted to touch a stale object: Post.
595
+
596
+ Comment.take.destroy!
597
+ # => begin transaction
598
+ DELETE FROM "comments" WHERE "comments"."id" = 1
599
+
600
+ UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) - 1,
601
+ "lock_version" = COALESCE("lock_version", 0) + 1 WHERE "posts"."id" = 1
602
+
603
+ UPDATE "posts" SET "updated_at" = '2017-12-11 21:42:47.785901',
604
+ "lock_version" = 1 WHERE "posts"."id" = 1 AND "posts"."lock_version" = 0
605
+ rollback transaction
606
+ # => ActiveRecord::StaleObjectError: Attempted to touch a stale object: Post.
607
+ ```
874
608
 
875
609
  After:
610
+ ```
611
+ post = Post.create!
612
+ # => begin transaction
613
+ INSERT INTO "posts" ("created_at", "updated_at", "lock_version")
614
+ VALUES ("2017-12-11 21:27:11.387397", "2017-12-11 21:27:11.387397", 0)
615
+ commit transaction
876
616
 
877
- Point.create(value: 1.0/0)
878
- Point.last.value # => Infinity
879
-
880
- *Innokenty Mikhailov*
881
-
882
- * Allow the PostgreSQL adapter to handle bigserial primary key types again.
883
-
884
- Fixes #10410.
885
-
886
- *Patrick Robertson*
887
-
888
- * Deprecate joining, eager loading and preloading of instance dependent
889
- associations without replacement. These operations happen before instances
890
- are created. The current behavior is unexpected and can result in broken
891
- behavior.
892
-
893
- Fixes #15024.
894
-
895
- *Yves Senn*
896
-
897
- * Fix `has_and_belongs_to_many` CollectionAssociation size calculations.
898
-
899
- `has_and_belongs_to_many` should fall back to using the normal CollectionAssociation's
900
- size calculation if the collection is not cached or loaded.
901
-
902
- Fixes #14913, #14914.
903
-
904
- *Fred Wu*
617
+ comment = Comment.create!(post: post)
618
+ # => begin transaction
619
+ INSERT INTO "comments" ("post_id") VALUES (1)
905
620
 
906
- * Return a non zero status when running `rake db:migrate:status` and migration table does
907
- not exist.
621
+ UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1,
622
+ "lock_version" = COALESCE("lock_version", 0) + 1,
623
+ "updated_at" = '2017-12-11 21:37:09.802642' WHERE "posts"."id" = 1
624
+ commit transaction
908
625
 
909
- *Paul B.*
626
+ comment.destroy!
627
+ # => begin transaction
628
+ DELETE FROM "comments" WHERE "comments"."id" = 1
910
629
 
911
- * Add support for module-level `table_name_suffix` in models.
630
+ UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) - 1,
631
+ "lock_version" = COALESCE("lock_version", 0) + 1,
632
+ "updated_at" = '2017-12-11 21:39:02.685520' WHERE "posts"."id" = 1
633
+ commit transaction
634
+ ```
912
635
 
913
- This makes `table_name_suffix` work the same way as `table_name_prefix` when
914
- using namespaced models.
636
+ Fixes #31199.
915
637
 
916
- *Jenner LaFave*
638
+ *bogdanvlviv*
917
639
 
918
- * Revert the behaviour of `ActiveRecord::Relation#join` changed through 4.0 => 4.1 to 4.0.
640
+ * Add support for PostgreSQL operator classes to `add_index`.
919
641
 
920
- In 4.1.0 `Relation#join` is delegated to `Arel#SelectManager`.
921
- In 4.0 series it is delegated to `Array#join`.
922
-
923
- *Bogdan Gusiev*
924
-
925
- * Log nil binary column values correctly.
926
-
927
- When an object with a binary column is updated with a nil value
928
- in that column, the SQL logger would throw an exception when trying
929
- to log that nil value. This only occurs when updating a record
930
- that already has a non-nil value in that column since an initial nil
931
- value isn't included in the SQL anyway (at least, when dirty checking
932
- is enabled.) The column's new value will now be logged as `<NULL binary data>`
933
- to parallel the existing `<N bytes of binary data>` for non-nil values.
934
-
935
- *James Coleman*
936
-
937
- * Rails will now pass a custom validation context through to autosave associations
938
- in order to validate child associations with the same context.
939
-
940
- Fixes #13854.
642
+ Example:
941
643
 
942
- *Eric Chahin*, *Aaron Nelson*, *Kevin Casey*
644
+ add_index :users, :name, using: :gist, opclass: { name: :gist_trgm_ops }
943
645
 
944
- * Stringify all variables keys of MySQL connection configuration.
646
+ *Greg Navis*
945
647
 
946
- When `sql_mode` variable for MySQL adapters set in configuration as `String`
947
- was ignored and overwritten by strict mode option.
648
+ * Don't allow scopes to be defined which conflict with instance methods on `Relation`.
948
649
 
949
- Fixes #14895.
650
+ Fixes #31120.
950
651
 
951
- *Paul Nikitochkin*
652
+ *kinnrot*
952
653
 
953
- * Ensure SQLite3 statements are closed on errors.
654
+ * Add new error class `QueryCanceled` which will be raised
655
+ when canceling statement due to user request.
954
656
 
955
- Fixes #13631.
657
+ *Ryuta Kamizono*
956
658
 
957
- *Timur Alperovich*
659
+ * Add `#up_only` to database migrations for code that is only relevant when
660
+ migrating up, e.g. populating a new column.
958
661
 
959
- * Give `ActiveRecord::PredicateBuilder` private methods the privacy they deserve.
662
+ *Rich Daley*
960
663
 
961
- *Hector Satre*
664
+ * Require raw SQL fragments to be explicitly marked when used in
665
+ relation query methods.
962
666
 
963
- * When using a custom `join_table` name on a `habtm`, rails was not saving it
964
- on Reflections. This causes a problem when rails loads fixtures, because it
965
- uses the reflections to set database with fixtures.
667
+ Before:
668
+ ```
669
+ Article.order("LENGTH(title)")
670
+ ```
966
671
 
967
- Fixes #14845.
672
+ After:
673
+ ```
674
+ Article.order(Arel.sql("LENGTH(title)"))
675
+ ```
968
676
 
969
- *Kassio Borges*
677
+ This prevents SQL injection if applications use the [strongly
678
+ discouraged] form `Article.order(params[:my_order])`, under the
679
+ mistaken belief that only column names will be accepted.
970
680
 
971
- * Reset the cache when modifying a Relation with cached Arel.
972
- Additionally display a warning message to make the user aware.
681
+ Raw SQL strings will now cause a deprecation warning, which will
682
+ become an UnknownAttributeReference error in Rails 6.0. Applications
683
+ can opt in to the future behavior by setting `allow_unsafe_raw_sql`
684
+ to `:disabled`.
973
685
 
974
- *Yves Senn*
686
+ Common and judged-safe string values (such as simple column
687
+ references) are unaffected:
688
+ ```
689
+ Article.order("title DESC")
690
+ ```
975
691
 
976
- * PostgreSQL should internally use `:datetime` consistently for TimeStamp. Assures
977
- different spellings of timestamps are treated the same.
692
+ *Ben Toews*
978
693
 
979
- Example:
694
+ * `update_all` will now pass its values to `Type#cast` before passing them to
695
+ `Type#serialize`. This means that `update_all(foo: 'true')` will properly
696
+ persist a boolean.
980
697
 
981
- mytimestamp.simplified_type('timestamp without time zone')
982
- # => :datetime
983
- mytimestamp.simplified_type('timestamp(6) without time zone')
984
- # => also :datetime (previously would be :timestamp)
698
+ *Sean Griffin*
985
699
 
986
- See #14513.
700
+ * Add new error class `StatementTimeout` which will be raised
701
+ when statement timeout exceeded.
987
702
 
988
- *Jefferson Lai*
703
+ *Ryuta Kamizono*
989
704
 
990
- * `ActiveRecord::Base.no_touching` no longer triggers callbacks or start empty transactions.
705
+ * Fix `bin/rails db:migrate` with specified `VERSION`.
706
+ `bin/rails db:migrate` with empty VERSION behaves as without `VERSION`.
707
+ Check a format of `VERSION`: Allow a migration version number
708
+ or name of a migration file. Raise error if format of `VERSION` is invalid.
709
+ Raise error if target migration doesn't exist.
991
710
 
992
- Fixes #14841.
711
+ *bogdanvlviv*
993
712
 
994
- *Lucas Mazza*
713
+ * Fixed a bug where column orders for an index weren't written to
714
+ `db/schema.rb` when using the sqlite adapter.
995
715
 
996
- * Fix name collision with `Array#select!` with `Relation#select!`.
716
+ Fixes #30902.
997
717
 
998
- Fixes #14752.
718
+ *Paul Kuruvilla*
999
719
 
1000
- *Earl St Sauver*
720
+ * Remove deprecated method `#sanitize_conditions`.
1001
721
 
1002
- * Fix unexpected behavior for `has_many :through` associations going through
1003
- a scoped `has_many`.
722
+ *Rafael Mendonça França*
1004
723
 
1005
- If a `has_many` association is adjusted using a scope, and another
1006
- `has_many :through` uses this association, then the scope adjustment is
1007
- unexpectedly neglected.
724
+ * Remove deprecated method `#scope_chain`.
1008
725
 
1009
- Fixes #14537.
726
+ *Rafael Mendonça França*
1010
727
 
1011
- *Jan Habermann*
728
+ * Remove deprecated configuration `.error_on_ignored_order_or_limit`.
1012
729
 
1013
- * `@destroyed` should always be set to `false` when an object is duped.
730
+ *Rafael Mendonça França*
1014
731
 
1015
- *Kuldeep Aggarwal*
732
+ * Remove deprecated arguments from `#verify!`.
1016
733
 
1017
- * Enable `has_many` associations to support irregular inflections.
734
+ *Rafael Mendonça França*
1018
735
 
1019
- Fixes #8928.
736
+ * Remove deprecated argument `name` from `#indexes`.
1020
737
 
1021
- *arthurnn*, *Javier Goizueta*
738
+ *Rafael Mendonça França*
1022
739
 
1023
- * Fix `count` used with a grouping not returning a Hash.
740
+ * Remove deprecated method `ActiveRecord::Migrator.schema_migrations_table_name`.
1024
741
 
1025
- Fixes #14721.
742
+ *Rafael Mendonça França*
1026
743
 
1027
- *Eric Chahin*
744
+ * Remove deprecated method `supports_primary_key?`.
1028
745
 
1029
- * `sanitize_sql_like` helper method to escape a string for safe use in an SQL
1030
- LIKE statement.
746
+ *Rafael Mendonça França*
1031
747
 
1032
- Example:
748
+ * Remove deprecated method `supports_migrations?`.
1033
749
 
1034
- class Article
1035
- def self.search(term)
1036
- where("title LIKE ?", sanitize_sql_like(term))
1037
- end
1038
- end
750
+ *Rafael Mendonça França*
1039
751
 
1040
- Article.search("20% _reduction_")
1041
- # => Query looks like "... title LIKE '20\% \_reduction\_' ..."
752
+ * Remove deprecated methods `initialize_schema_migrations_table` and `initialize_internal_metadata_table`.
1042
753
 
1043
- *Rob Gilson*, *Yves Senn*
754
+ *Rafael Mendonça França*
1044
755
 
1045
- * Do not quote uuid default value on `change_column`.
756
+ * Raises when calling `lock!` in a dirty record.
1046
757
 
1047
- Fixes #14604.
758
+ *Rafael Mendonça França*
1048
759
 
1049
- *Eric Chahin*
760
+ * Remove deprecated support to passing a class to `:class_name` on associations.
1050
761
 
1051
- * The comparison between `Relation` and `CollectionProxy` should be consistent.
762
+ *Rafael Mendonça França*
1052
763
 
1053
- Example:
764
+ * Remove deprecated argument `default` from `index_name_exists?`.
1054
765
 
1055
- author.posts == Post.where(author_id: author.id)
1056
- # => true
1057
- Post.where(author_id: author.id) == author.posts
1058
- # => true
766
+ *Rafael Mendonça França*
1059
767
 
1060
- Fixes #13506.
768
+ * Remove deprecated support to `quoted_id` when typecasting an Active Record object.
1061
769
 
1062
- *Lauro Caetano*
770
+ *Rafael Mendonça França*
1063
771
 
1064
- * Calling `delete_all` on an unloaded `CollectionProxy` no longer
1065
- generates an SQL statement containing each id of the collection:
772
+ * Fix `bin/rails db:setup` and `bin/rails db:test:prepare` create wrong
773
+ ar_internal_metadata's data for a test database.
1066
774
 
1067
775
  Before:
1068
-
1069
- DELETE FROM `model` WHERE `model`.`parent_id` = 1
1070
- AND `model`.`id` IN (1, 2, 3...)
776
+ ```
777
+ $ RAILS_ENV=test rails dbconsole
778
+ > SELECT * FROM ar_internal_metadata;
779
+ key|value|created_at|updated_at
780
+ environment|development|2017-09-11 23:14:10.815679|2017-09-11 23:14:10.815679
781
+ ```
1071
782
 
1072
783
  After:
784
+ ```
785
+ $ RAILS_ENV=test rails dbconsole
786
+ > SELECT * FROM ar_internal_metadata;
787
+ key|value|created_at|updated_at
788
+ environment|test|2017-09-11 23:14:10.815679|2017-09-11 23:14:10.815679
789
+ ```
1073
790
 
1074
- DELETE FROM `model` WHERE `model`.`parent_id` = 1
791
+ Fixes #26731.
1075
792
 
1076
- *Eileen M. Uchitelle*, *Aaron Patterson*
793
+ *bogdanvlviv*
1077
794
 
1078
- * Fix invalid SQL when aggregate methods (`empty?`, `any?`, `count`) used
1079
- with `select`.
795
+ * Fix longer sequence name detection for serial columns.
1080
796
 
1081
- Fixes #13648.
797
+ Fixes #28332.
1082
798
 
1083
- *Simon Woker*
799
+ *Ryuta Kamizono*
1084
800
 
1085
- * PostgreSQL adapter only warns once for every missing OID per connection.
801
+ * MySQL: Don't lose `auto_increment: true` in the `db/schema.rb`.
1086
802
 
1087
- Fixes #14275.
803
+ Fixes #30894.
1088
804
 
1089
- *Matthew Draper*, *Yves Senn*
805
+ *Ryuta Kamizono*
1090
806
 
1091
- * PostgreSQL adapter automatically reloads it's type map when encountering
1092
- unknown OIDs.
807
+ * Fix `COUNT(DISTINCT ...)` for `GROUP BY` with `ORDER BY` and `LIMIT`.
1093
808
 
1094
- Fixes #14678.
809
+ Fixes #30886.
1095
810
 
1096
- *Matthew Draper*, *Yves Senn*
811
+ *Ryuta Kamizono*
1097
812
 
1098
- * Fix insertion of records via `has_many :through` association with scope.
813
+ * PostgreSQL `tsrange` now preserves subsecond precision.
1099
814
 
1100
- Fixes #3548.
815
+ PostgreSQL 9.1+ introduced range types, and Rails added support for using
816
+ this datatype in Active Record. However, the serialization of
817
+ `PostgreSQL::OID::Range` was incomplete, because it did not properly
818
+ cast the bounds that make up the range. This led to subseconds being
819
+ dropped in SQL commands:
1101
820
 
1102
- *Ivan Antropov*
821
+ Before:
1103
822
 
1104
- * Auto-generate stable fixture UUIDs on PostgreSQL.
823
+ connection.type_cast(tsrange.serialize(range_value))
824
+ # => "[2010-01-01 13:30:00 UTC,2011-02-02 19:30:00 UTC)"
1105
825
 
1106
- Fixes #11524.
826
+ Now:
1107
827
 
1108
- *Roderick van Domburg*
828
+ connection.type_cast(tsrange.serialize(range_value))
829
+ # => "[2010-01-01 13:30:00.670277,2011-02-02 19:30:00.745125)"
1109
830
 
1110
- * Fix a problem where an enum would overwrite values of another enum with the
1111
- same name in an unrelated class.
831
+ *Thomas Cannon*
1112
832
 
1113
- Fixes #14607.
833
+ * Passing a `Set` to `Relation#where` now behaves the same as passing an
834
+ array.
1114
835
 
1115
- *Evan Whalen*
836
+ *Sean Griffin*
1116
837
 
1117
- * PostgreSQL and SQLite string columns no longer have a default limit of 255.
838
+ * Use given algorithm while removing index from database.
1118
839
 
1119
- Fixes #13435, #9153.
840
+ Fixes #24190.
1120
841
 
1121
- *Vladimir Sazhin*, *Toms Mikoss*, *Yves Senn*
842
+ *Mehmet Emin İNAÇ*
1122
843
 
1123
- * Make possible to have an association called `records`.
844
+ * Update payload names for `sql.active_record` instrumentation to be
845
+ more descriptive.
1124
846
 
1125
- Fixes #11645.
847
+ Fixes #30586.
1126
848
 
1127
- *prathamesh-sonpatki*
849
+ *Jeremy Green*
1128
850
 
1129
- * `to_sql` on an association now matches the query that is actually executed, where it
1130
- could previously have incorrectly accrued additional conditions (e.g. as a result of
1131
- a previous query). `CollectionProxy` now always defers to the association scope's
1132
- `arel` method so the (incorrect) inherited one should be entirely concealed.
851
+ * Add new error class `LockWaitTimeout` which will be raised
852
+ when lock wait timeout exceeded.
1133
853
 
1134
- Fixes #14003.
854
+ *Gabriel Courtemanche*
1135
855
 
1136
- *Jefferson Lai*
856
+ * Remove deprecated `#migration_keys`.
1137
857
 
1138
- * Block a few default Class methods as scope name.
858
+ *Ryuta Kamizono*
1139
859
 
1140
- For instance, this will raise:
860
+ * Automatically guess the inverse associations for STI.
1141
861
 
1142
- scope :public, -> { where(status: 1) }
862
+ *Yuichiro Kaneko*
1143
863
 
1144
- *arthurnn*
864
+ * Ensure `sum` honors `distinct` on `has_many :through` associations.
1145
865
 
1146
- * Fix error when using `with_options` with lambda.
866
+ Fixes #16791.
1147
867
 
1148
- Fixes #9805.
868
+ *Aaron Wortham*
1149
869
 
1150
- *Lauro Caetano*
870
+ * Add `binary` fixture helper method.
1151
871
 
1152
- * Switch `sqlite3:///` URLs (which were temporarily
1153
- deprecated in 4.1) from relative to absolute.
872
+ *Atsushi Yoshida*
1154
873
 
1155
- If you still want the previous interpretation, you should replace
1156
- `sqlite3:///my/path` with `sqlite3:my/path`.
874
+ * When using `Relation#or`, extract the common conditions and put them before the OR condition.
1157
875
 
1158
- *Matthew Draper*
876
+ *Maxime Handfield Lapointe*
1159
877
 
1160
- * Treat blank UUID values as `nil`.
878
+ * `Relation#or` now accepts two relations who have different values for
879
+ `references` only, as `references` can be implicitly called by `where`.
1161
880
 
1162
- Example:
881
+ Fixes #29411.
1163
882
 
1164
- Sample.new(uuid_field: '') #=> <Sample id: nil, uuid_field: nil>
883
+ *Sean Griffin*
1165
884
 
1166
- *Dmitry Lavrov*
885
+ * `ApplicationRecord` is no longer generated when generating models. If you
886
+ need to generate it, it can be created with `rails g application_record`.
1167
887
 
1168
- * Enable support for materialized views on PostgreSQL >= 9.3.
888
+ *Lisa Ugray*
1169
889
 
1170
- *Dave Lee*
890
+ * Fix `COUNT(DISTINCT ...)` with `ORDER BY` and `LIMIT` to keep the existing select list.
1171
891
 
1172
- * The PostgreSQL adapter supports custom domains. Fixes #14305.
892
+ *Ryuta Kamizono*
1173
893
 
1174
- *Yves Senn*
894
+ * When a `has_one` association is destroyed by `dependent: destroy`,
895
+ `destroyed_by_association` will now be set to the reflection, matching the
896
+ behaviour of `has_many` associations.
1175
897
 
1176
- * PostgreSQL `Column#type` is now determined through the corresponding OID.
1177
- The column types stay the same except for enum columns. They no longer have
1178
- `nil` as type but `enum`.
898
+ *Lisa Ugray*
1179
899
 
1180
- See #7814.
900
+ * Fix `unscoped(where: [columns])` removing the wrong bind values.
1181
901
 
1182
- *Yves Senn*
902
+ When the `where` is called on a relation after a `or`, unscoping the column of that later `where` removed
903
+ bind values used by the `or` instead. (possibly other cases too)
1183
904
 
1184
- * Fix error when specifying a non-empty default value on a PostgreSQL array
1185
- column.
905
+ ```
906
+ Post.where(id: 1).or(Post.where(id: 2)).where(foo: 3).unscope(where: :foo).to_sql
907
+ # Currently:
908
+ # SELECT "posts".* FROM "posts" WHERE ("posts"."id" = 2 OR "posts"."id" = 3)
909
+ # With fix:
910
+ # SELECT "posts".* FROM "posts" WHERE ("posts"."id" = 1 OR "posts"."id" = 2)
911
+ ```
1186
912
 
1187
- Fixes #10613.
913
+ *Maxime Handfield Lapointe*
1188
914
 
1189
- *Luke Steensen*
915
+ * Values constructed using multi-parameter assignment will now use the
916
+ post-type-cast value for rendering in single-field form inputs.
1190
917
 
1191
- * Fix error where `.persisted?` throws SystemStackError for an unsaved model with a
1192
- custom primary key that did not save due to validation error.
918
+ *Sean Griffin*
1193
919
 
1194
- Fixes #14393.
920
+ * `Relation#joins` is no longer affected by the target model's
921
+ `current_scope`, with the exception of `unscoped`.
1195
922
 
1196
- *Chris Finne*
923
+ Fixes #29338.
1197
924
 
1198
- * Introduce `validate` as an alias for `valid?`.
925
+ *Sean Griffin*
1199
926
 
1200
- This is more intuitive when you want to run validations but don't care about the return value.
927
+ * Change sqlite3 boolean serialization to use 1 and 0.
1201
928
 
1202
- *Henrik Nyh*
929
+ SQLite natively recognizes 1 and 0 as true and false, but does not natively
930
+ recognize 't' and 'f' as was previously serialized.
1203
931
 
1204
- * Create indexes inline in CREATE TABLE for MySQL.
932
+ This change in serialization requires a migration of stored boolean data
933
+ for SQLite databases, so it's implemented behind a configuration flag
934
+ whose default false value is deprecated.
1205
935
 
1206
- This is important, because adding an index on a temporary table after it has been created
1207
- would commit the transaction.
936
+ *Lisa Ugray*
1208
937
 
1209
- It also allows creating and dropping indexed tables with fewer queries and fewer permissions
1210
- required.
938
+ * Skip query caching when working with batches of records (`find_each`, `find_in_batches`,
939
+ `in_batches`).
1211
940
 
1212
- Example:
941
+ Previously, records would be fetched in batches, but all records would be retained in memory
942
+ until the end of the request or job.
1213
943
 
1214
- create_table :temp, temporary: true, as: "SELECT id, name, zip FROM a_really_complicated_query" do |t|
1215
- t.index :zip
1216
- end
1217
- # => CREATE TEMPORARY TABLE temp (INDEX (zip)) AS SELECT id, name, zip FROM a_really_complicated_query
944
+ *Eugene Kenny*
1218
945
 
1219
- *Cody Cutrer*, *Steve Rice*, *Rafael Mendonça Franca*
946
+ * Prevent errors raised by `sql.active_record` notification subscribers from being converted into
947
+ `ActiveRecord::StatementInvalid` exceptions.
1220
948
 
1221
- * Use singular table name in generated migrations when
1222
- `ActiveRecord::Base.pluralize_table_names` is `false`.
949
+ *Dennis Taylor*
1223
950
 
1224
- Fixes #13426.
951
+ * Fix eager loading/preloading association with scope including joins.
1225
952
 
1226
- *Kuldeep Aggarwal*
953
+ Fixes #28324.
1227
954
 
1228
- * `touch` accepts many attributes to be touched at once.
955
+ *Ryuta Kamizono*
1229
956
 
1230
- Example:
957
+ * Fix transactions to apply state to child transactions.
1231
958
 
1232
- # touches :signed_at, :sealed_at, and :updated_at/on attributes.
1233
- Photo.last.touch(:signed_at, :sealed_at)
959
+ Previously, if you had a nested transaction and the outer transaction was rolledback, the record from the
960
+ inner transaction would still be marked as persisted.
1234
961
 
1235
- *James Pinto*
962
+ This change fixes that by applying the state of the parent transaction to the child transaction when the
963
+ parent transaction is rolledback. This will correctly mark records from the inner transaction as not persisted.
1236
964
 
1237
- * `rake db:structure:dump` only dumps schema information if the schema
1238
- migration table exists.
965
+ *Eileen M. Uchitelle*, *Aaron Patterson*
1239
966
 
1240
- Fixes #14217.
967
+ * Deprecate `set_state` method in `TransactionState`.
1241
968
 
1242
- *Yves Senn*
969
+ Deprecated the `set_state` method in favor of setting the state via specific methods. If you need to mark the
970
+ state of the transaction you can now use `rollback!`, `commit!` or `nullify!` instead of
971
+ `set_state(:rolledback)`, `set_state(:committed)`, or `set_state(nil)`.
1243
972
 
1244
- * Reap connections that were checked out by now-dead threads, instead
1245
- of waiting until they disconnect by themselves. Before this change,
1246
- a suitably constructed series of short-lived threads could starve
1247
- the connection pool, without ever having more than a couple alive at
1248
- the same time.
973
+ *Eileen M. Uchitelle*, *Aaron Patterson*
1249
974
 
1250
- *Matthew Draper*
975
+ * Deprecate delegating to `arel` in `Relation`.
1251
976
 
1252
- * `pk_and_sequence_for` now ensures that only the pg_depend entries
1253
- pointing to pg_class, and thus only sequence objects, are considered.
977
+ *Ryuta Kamizono*
1254
978
 
1255
- *Josh Williams*
979
+ * Query cache was unavailable when entering the `ActiveRecord::Base.cache` block
980
+ without being connected.
1256
981
 
1257
- * `where.not` adds `references` for `includes` like normal `where` calls do.
982
+ *Tsukasa Oishi*
1258
983
 
1259
- Fixes #14406.
984
+ * Previously, when building records using a `has_many :through` association,
985
+ if the child records were deleted before the parent was saved, they would
986
+ still be persisted. Now, if child records are deleted before the parent is saved
987
+ on a `has_many :through` association, the child records will not be persisted.
1260
988
 
1261
- *Yves Senn*
989
+ *Tobias Kraze*
1262
990
 
1263
- * Extend fixture `$LABEL` replacement to allow string interpolation.
991
+ * Merging two relations representing nested joins no longer transforms the joins of
992
+ the merged relation into LEFT OUTER JOIN.
1264
993
 
1265
994
  Example:
1266
995
 
1267
- martin:
1268
- email: $LABEL@email.com
1269
-
1270
- users(:martin).email # => martin@email.com
996
+ ```
997
+ Author.joins(:posts).merge(Post.joins(:comments))
998
+ # Before the change:
999
+ #=> SELECT ... FROM authors INNER JOIN posts ON ... LEFT OUTER JOIN comments ON...
1271
1000
 
1272
- *Eric Steele*
1001
+ # After the change:
1002
+ #=> SELECT ... FROM authors INNER JOIN posts ON ... INNER JOIN comments ON...
1003
+ ```
1273
1004
 
1274
- * Add support for `Relation` be passed as parameter on `QueryCache#select_all`.
1005
+ *Maxime Handfield Lapointe*
1275
1006
 
1276
- Fixes #14361.
1007
+ * `ActiveRecord::Persistence#touch` does not work well when optimistic locking enabled and
1008
+ `locking_column`, without default value, is null in the database.
1277
1009
 
1278
- *arthurnn*
1010
+ *bogdanvlviv*
1279
1011
 
1280
- * Passing an Active Record object to `find` or `exists?` is now deprecated.
1281
- Call `.id` on the object first.
1012
+ * Fix destroying existing object does not work well when optimistic locking enabled and
1013
+ `locking_column` is null in the database.
1282
1014
 
1283
- *Aaron Patterson*
1284
-
1285
- * Only use BINARY for MySQL case sensitive uniqueness check when column
1286
- has a case insensitive collation.
1287
-
1288
- *Ryuta Kamizono*
1015
+ *bogdanvlviv*
1289
1016
 
1290
- * Support for MySQL 5.6 fractional seconds.
1017
+ * Use bulk INSERT to insert fixtures for better performance.
1291
1018
 
1292
- *arthurnn*, *Tatsuhiko Miyagawa*
1019
+ *Kir Shatrov*
1293
1020
 
1294
- * Support for PostgreSQL `citext` data type enabling case-insensitive
1295
- `where` values without needing to wrap in UPPER/LOWER sql functions.
1021
+ * Prevent creation of bind param if casted value is nil.
1296
1022
 
1297
- *Troy Kruthoff*, *Lachlan Sylvester*
1298
-
1299
- * Only save has_one associations if record has changes.
1300
- Previously after save related callbacks, such as `#after_commit`, were triggered when the has_one
1301
- object did not get saved to the db.
1023
+ *Ryuta Kamizono*
1302
1024
 
1303
- *Alan Kennedy*
1025
+ * Deprecate passing arguments and block at the same time to `count` and `sum` in `ActiveRecord::Calculations`.
1304
1026
 
1305
- * Allow strings to specify the `#order` value.
1027
+ *Ryuta Kamizono*
1306
1028
 
1307
- Example:
1029
+ * Loading model schema from database is now thread-safe.
1308
1030
 
1309
- Model.order(id: 'asc').to_sql == Model.order(id: :asc).to_sql
1031
+ Fixes #28589.
1310
1032
 
1311
- *Marcelo Casiraghi*, *Robin Dupret*
1033
+ *Vikrant Chaudhary*, *David Abdemoulaie*
1312
1034
 
1313
- * Dynamically register PostgreSQL enum OIDs. This prevents "unknown OID"
1314
- warnings on enum columns.
1035
+ * Add `ActiveRecord::Base#cache_version` to support recyclable cache keys via the new versioned entries
1036
+ in `ActiveSupport::Cache`. This also means that `ActiveRecord::Base#cache_key` will now return a stable key
1037
+ that does not include a timestamp any more.
1315
1038
 
1316
- *Dieter Komendera*
1039
+ NOTE: This feature is turned off by default, and `#cache_key` will still return cache keys with timestamps
1040
+ until you set `ActiveRecord::Base.cache_versioning = true`. That's the setting for all new apps on Rails 5.2+
1317
1041
 
1318
- * `includes` is able to detect the right preloading strategy when string
1319
- joins are involved.
1042
+ *DHH*
1320
1043
 
1321
- Fixes #14109.
1044
+ * Respect `SchemaDumper.ignore_tables` in rake tasks for databases structure dump.
1322
1045
 
1323
- *Aaron Patterson*, *Yves Senn*
1046
+ *Rusty Geldmacher*, *Guillermo Iguaran*
1324
1047
 
1325
- * Fix error with validation with enum fields for records where the value for
1326
- any enum attribute is always evaluated as 0 during uniqueness validation.
1048
+ * Add type caster to `RuntimeReflection#alias_name`.
1327
1049
 
1328
- Fixes #14172.
1050
+ Fixes #28959.
1329
1051
 
1330
- *Vilius Luneckas* *Ahmed AbouElhamayed*
1052
+ *Jon Moss*
1331
1053
 
1332
- * `before_add` callbacks are fired before the record is saved on
1333
- `has_and_belongs_to_many` associations *and* on `has_many :through`
1334
- associations. Before this change, `before_add` callbacks would be fired
1335
- before the record was saved on `has_and_belongs_to_many` associations, but
1336
- *not* on `has_many :through` associations.
1054
+ * Deprecate `supports_statement_cache?`.
1337
1055
 
1338
- Fixes #14144.
1056
+ *Ryuta Kamizono*
1339
1057
 
1340
- * Fix STI classes not defining an attribute method if there is a conflicting
1341
- private method defined on its ancestors.
1058
+ * Raise error `UnknownMigrationVersionError` on the movement of migrations
1059
+ when the current migration does not exist.
1342
1060
 
1343
- Fixes #11569.
1061
+ *bogdanvlviv*
1344
1062
 
1345
- *Godfrey Chan*
1063
+ * Fix `bin/rails db:forward` first migration.
1346
1064
 
1347
- * Coerce strings when reading attributes. Fixes #10485.
1065
+ *bogdanvlviv*
1348
1066
 
1349
- Example:
1067
+ * Support Descending Indexes for MySQL.
1350
1068
 
1351
- book = Book.new(title: 12345)
1352
- book.save!
1353
- book.title # => "12345"
1069
+ MySQL 8.0.1 and higher supports descending indexes: `DESC` in an index definition is no longer ignored.
1070
+ See https://dev.mysql.com/doc/refman/8.0/en/descending-indexes.html.
1354
1071
 
1355
- *Yves Senn*
1072
+ *Ryuta Kamizono*
1356
1073
 
1357
- * Deprecate half-baked support for PostgreSQL range values with excluding beginnings.
1358
- We currently map PostgreSQL ranges to Ruby ranges. This conversion is not fully
1359
- possible because the Ruby range does not support excluded beginnings.
1074
+ * Fix inconsistency with changed attributes when overriding Active Record attribute reader.
1360
1075
 
1361
- The current solution of incrementing the beginning is not correct and is now
1362
- deprecated. For subtypes where we don't know how to increment (e.g. `#succ`
1363
- is not defined) it will raise an `ArgumentException` for ranges with excluding
1364
- beginnings.
1076
+ *bogdanvlviv*
1365
1077
 
1366
- *Yves Senn*
1078
+ * When calling the dynamic fixture accessor method with no arguments, it now returns all fixtures of this type.
1079
+ Previously this method always returned an empty array.
1367
1080
 
1368
- * Support for user created range types in PostgreSQL.
1081
+ *Kevin McPhillips*
1369
1082
 
1370
- *Yves Senn*
1371
1083
 
1372
- Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/activerecord/CHANGELOG.md) for previous changes.
1084
+ Please check [5-1-stable](https://github.com/rails/rails/blob/5-1-stable/activerecord/CHANGELOG.md) for previous changes.