activerecord 3.2.19 → 5.0.0

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 (264) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +1715 -604
  3. data/MIT-LICENSE +2 -2
  4. data/README.rdoc +40 -45
  5. data/examples/performance.rb +33 -22
  6. data/examples/simple.rb +3 -4
  7. data/lib/active_record/aggregations.rb +76 -51
  8. data/lib/active_record/association_relation.rb +35 -0
  9. data/lib/active_record/associations/alias_tracker.rb +54 -40
  10. data/lib/active_record/associations/association.rb +76 -56
  11. data/lib/active_record/associations/association_scope.rb +125 -93
  12. data/lib/active_record/associations/belongs_to_association.rb +57 -28
  13. data/lib/active_record/associations/belongs_to_polymorphic_association.rb +7 -2
  14. data/lib/active_record/associations/builder/association.rb +120 -32
  15. data/lib/active_record/associations/builder/belongs_to.rb +115 -62
  16. data/lib/active_record/associations/builder/collection_association.rb +61 -53
  17. data/lib/active_record/associations/builder/has_and_belongs_to_many.rb +117 -43
  18. data/lib/active_record/associations/builder/has_many.rb +9 -65
  19. data/lib/active_record/associations/builder/has_one.rb +18 -52
  20. data/lib/active_record/associations/builder/singular_association.rb +18 -19
  21. data/lib/active_record/associations/collection_association.rb +268 -186
  22. data/lib/active_record/associations/collection_proxy.rb +1003 -63
  23. data/lib/active_record/associations/foreign_association.rb +11 -0
  24. data/lib/active_record/associations/has_many_association.rb +81 -41
  25. data/lib/active_record/associations/has_many_through_association.rb +76 -55
  26. data/lib/active_record/associations/has_one_association.rb +51 -21
  27. data/lib/active_record/associations/has_one_through_association.rb +1 -1
  28. data/lib/active_record/associations/join_dependency/join_association.rb +83 -108
  29. data/lib/active_record/associations/join_dependency/join_base.rb +7 -9
  30. data/lib/active_record/associations/join_dependency/join_part.rb +30 -37
  31. data/lib/active_record/associations/join_dependency.rb +239 -155
  32. data/lib/active_record/associations/preloader/association.rb +97 -62
  33. data/lib/active_record/associations/preloader/collection_association.rb +2 -8
  34. data/lib/active_record/associations/preloader/has_many_through.rb +7 -3
  35. data/lib/active_record/associations/preloader/has_one.rb +0 -8
  36. data/lib/active_record/associations/preloader/singular_association.rb +3 -3
  37. data/lib/active_record/associations/preloader/through_association.rb +75 -33
  38. data/lib/active_record/associations/preloader.rb +111 -79
  39. data/lib/active_record/associations/singular_association.rb +35 -13
  40. data/lib/active_record/associations/through_association.rb +41 -19
  41. data/lib/active_record/associations.rb +727 -501
  42. data/lib/active_record/attribute/user_provided_default.rb +28 -0
  43. data/lib/active_record/attribute.rb +213 -0
  44. data/lib/active_record/attribute_assignment.rb +32 -162
  45. data/lib/active_record/attribute_decorators.rb +67 -0
  46. data/lib/active_record/attribute_methods/before_type_cast.rb +52 -7
  47. data/lib/active_record/attribute_methods/dirty.rb +101 -61
  48. data/lib/active_record/attribute_methods/primary_key.rb +50 -36
  49. data/lib/active_record/attribute_methods/query.rb +7 -6
  50. data/lib/active_record/attribute_methods/read.rb +56 -117
  51. data/lib/active_record/attribute_methods/serialization.rb +43 -96
  52. data/lib/active_record/attribute_methods/time_zone_conversion.rb +93 -42
  53. data/lib/active_record/attribute_methods/write.rb +34 -45
  54. data/lib/active_record/attribute_methods.rb +333 -144
  55. data/lib/active_record/attribute_mutation_tracker.rb +70 -0
  56. data/lib/active_record/attribute_set/builder.rb +108 -0
  57. data/lib/active_record/attribute_set.rb +108 -0
  58. data/lib/active_record/attributes.rb +265 -0
  59. data/lib/active_record/autosave_association.rb +285 -223
  60. data/lib/active_record/base.rb +95 -490
  61. data/lib/active_record/callbacks.rb +95 -61
  62. data/lib/active_record/coders/json.rb +13 -0
  63. data/lib/active_record/coders/yaml_column.rb +28 -19
  64. data/lib/active_record/collection_cache_key.rb +40 -0
  65. data/lib/active_record/connection_adapters/abstract/connection_pool.rb +724 -277
  66. data/lib/active_record/connection_adapters/abstract/database_limits.rb +9 -0
  67. data/lib/active_record/connection_adapters/abstract/database_statements.rb +199 -192
  68. data/lib/active_record/connection_adapters/abstract/query_cache.rb +31 -26
  69. data/lib/active_record/connection_adapters/abstract/quoting.rb +140 -57
  70. data/lib/active_record/connection_adapters/abstract/savepoints.rb +21 -0
  71. data/lib/active_record/connection_adapters/abstract/schema_creation.rb +147 -0
  72. data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +419 -276
  73. data/lib/active_record/connection_adapters/abstract/schema_dumper.rb +105 -0
  74. data/lib/active_record/connection_adapters/abstract/schema_statements.rb +963 -276
  75. data/lib/active_record/connection_adapters/abstract/transaction.rb +232 -0
  76. data/lib/active_record/connection_adapters/abstract_adapter.rb +397 -106
  77. data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +643 -342
  78. data/lib/active_record/connection_adapters/column.rb +30 -259
  79. data/lib/active_record/connection_adapters/connection_specification.rb +263 -0
  80. data/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb +22 -0
  81. data/lib/active_record/connection_adapters/mysql/column.rb +50 -0
  82. data/lib/active_record/connection_adapters/mysql/database_statements.rb +125 -0
  83. data/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb +70 -0
  84. data/lib/active_record/connection_adapters/mysql/quoting.rb +51 -0
  85. data/lib/active_record/connection_adapters/mysql/schema_creation.rb +67 -0
  86. data/lib/active_record/connection_adapters/mysql/schema_definitions.rb +93 -0
  87. data/lib/active_record/connection_adapters/mysql/schema_dumper.rb +54 -0
  88. data/lib/active_record/connection_adapters/mysql/type_metadata.rb +32 -0
  89. data/lib/active_record/connection_adapters/mysql2_adapter.rb +47 -196
  90. data/lib/active_record/connection_adapters/postgresql/column.rb +15 -0
  91. data/lib/active_record/connection_adapters/postgresql/database_statements.rb +170 -0
  92. data/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb +42 -0
  93. data/lib/active_record/connection_adapters/postgresql/oid/array.rb +70 -0
  94. data/lib/active_record/connection_adapters/postgresql/oid/bit.rb +52 -0
  95. data/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb +13 -0
  96. data/lib/active_record/connection_adapters/postgresql/oid/bytea.rb +15 -0
  97. data/lib/active_record/connection_adapters/postgresql/oid/cidr.rb +48 -0
  98. data/lib/active_record/connection_adapters/postgresql/oid/date_time.rb +21 -0
  99. data/lib/active_record/connection_adapters/postgresql/oid/decimal.rb +13 -0
  100. data/lib/active_record/connection_adapters/postgresql/oid/enum.rb +19 -0
  101. data/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +59 -0
  102. data/lib/active_record/connection_adapters/postgresql/oid/inet.rb +13 -0
  103. data/lib/active_record/connection_adapters/postgresql/oid/json.rb +10 -0
  104. data/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb +23 -0
  105. data/lib/active_record/connection_adapters/postgresql/oid/money.rb +39 -0
  106. data/lib/active_record/connection_adapters/postgresql/oid/point.rb +43 -0
  107. data/lib/active_record/connection_adapters/postgresql/oid/rails_5_1_point.rb +50 -0
  108. data/lib/active_record/connection_adapters/postgresql/oid/range.rb +93 -0
  109. data/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb +15 -0
  110. data/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb +109 -0
  111. data/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +21 -0
  112. data/lib/active_record/connection_adapters/postgresql/oid/vector.rb +26 -0
  113. data/lib/active_record/connection_adapters/postgresql/oid/xml.rb +28 -0
  114. data/lib/active_record/connection_adapters/postgresql/oid.rb +31 -0
  115. data/lib/active_record/connection_adapters/postgresql/quoting.rb +116 -0
  116. data/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +49 -0
  117. data/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +180 -0
  118. data/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +47 -0
  119. data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +682 -0
  120. data/lib/active_record/connection_adapters/postgresql/type_metadata.rb +35 -0
  121. data/lib/active_record/connection_adapters/postgresql/utils.rb +77 -0
  122. data/lib/active_record/connection_adapters/postgresql_adapter.rb +558 -1039
  123. data/lib/active_record/connection_adapters/schema_cache.rb +74 -36
  124. data/lib/active_record/connection_adapters/sql_type_metadata.rb +32 -0
  125. data/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb +19 -0
  126. data/lib/active_record/connection_adapters/sqlite3/quoting.rb +48 -0
  127. data/lib/active_record/connection_adapters/sqlite3/schema_creation.rb +22 -0
  128. data/lib/active_record/connection_adapters/sqlite3_adapter.rb +538 -24
  129. data/lib/active_record/connection_adapters/statement_pool.rb +31 -12
  130. data/lib/active_record/connection_handling.rb +155 -0
  131. data/lib/active_record/core.rb +561 -0
  132. data/lib/active_record/counter_cache.rb +146 -105
  133. data/lib/active_record/dynamic_matchers.rb +101 -64
  134. data/lib/active_record/enum.rb +234 -0
  135. data/lib/active_record/errors.rb +153 -56
  136. data/lib/active_record/explain.rb +15 -63
  137. data/lib/active_record/explain_registry.rb +30 -0
  138. data/lib/active_record/explain_subscriber.rb +10 -6
  139. data/lib/active_record/fixture_set/file.rb +77 -0
  140. data/lib/active_record/fixtures.rb +355 -232
  141. data/lib/active_record/gem_version.rb +15 -0
  142. data/lib/active_record/inheritance.rb +144 -79
  143. data/lib/active_record/integration.rb +66 -13
  144. data/lib/active_record/internal_metadata.rb +56 -0
  145. data/lib/active_record/legacy_yaml_adapter.rb +46 -0
  146. data/lib/active_record/locale/en.yml +9 -1
  147. data/lib/active_record/locking/optimistic.rb +77 -56
  148. data/lib/active_record/locking/pessimistic.rb +6 -6
  149. data/lib/active_record/log_subscriber.rb +53 -28
  150. data/lib/active_record/migration/command_recorder.rb +166 -33
  151. data/lib/active_record/migration/compatibility.rb +126 -0
  152. data/lib/active_record/migration/join_table.rb +15 -0
  153. data/lib/active_record/migration.rb +792 -264
  154. data/lib/active_record/model_schema.rb +192 -130
  155. data/lib/active_record/nested_attributes.rb +238 -145
  156. data/lib/active_record/no_touching.rb +52 -0
  157. data/lib/active_record/null_relation.rb +89 -0
  158. data/lib/active_record/persistence.rb +357 -157
  159. data/lib/active_record/query_cache.rb +22 -43
  160. data/lib/active_record/querying.rb +34 -23
  161. data/lib/active_record/railtie.rb +88 -48
  162. data/lib/active_record/railties/console_sandbox.rb +3 -4
  163. data/lib/active_record/railties/controller_runtime.rb +5 -4
  164. data/lib/active_record/railties/databases.rake +170 -422
  165. data/lib/active_record/railties/jdbcmysql_error.rb +1 -1
  166. data/lib/active_record/readonly_attributes.rb +2 -5
  167. data/lib/active_record/reflection.rb +715 -189
  168. data/lib/active_record/relation/batches/batch_enumerator.rb +67 -0
  169. data/lib/active_record/relation/batches.rb +203 -50
  170. data/lib/active_record/relation/calculations.rb +203 -194
  171. data/lib/active_record/relation/delegation.rb +103 -25
  172. data/lib/active_record/relation/finder_methods.rb +457 -261
  173. data/lib/active_record/relation/from_clause.rb +32 -0
  174. data/lib/active_record/relation/merger.rb +167 -0
  175. data/lib/active_record/relation/predicate_builder/array_handler.rb +43 -0
  176. data/lib/active_record/relation/predicate_builder/association_query_handler.rb +88 -0
  177. data/lib/active_record/relation/predicate_builder/base_handler.rb +17 -0
  178. data/lib/active_record/relation/predicate_builder/basic_object_handler.rb +17 -0
  179. data/lib/active_record/relation/predicate_builder/class_handler.rb +27 -0
  180. data/lib/active_record/relation/predicate_builder/polymorphic_array_handler.rb +57 -0
  181. data/lib/active_record/relation/predicate_builder/range_handler.rb +33 -0
  182. data/lib/active_record/relation/predicate_builder/relation_handler.rb +13 -0
  183. data/lib/active_record/relation/predicate_builder.rb +153 -48
  184. data/lib/active_record/relation/query_attribute.rb +19 -0
  185. data/lib/active_record/relation/query_methods.rb +1019 -194
  186. data/lib/active_record/relation/record_fetch_warning.rb +49 -0
  187. data/lib/active_record/relation/spawn_methods.rb +46 -150
  188. data/lib/active_record/relation/where_clause.rb +174 -0
  189. data/lib/active_record/relation/where_clause_factory.rb +38 -0
  190. data/lib/active_record/relation.rb +450 -245
  191. data/lib/active_record/result.rb +104 -12
  192. data/lib/active_record/runtime_registry.rb +22 -0
  193. data/lib/active_record/sanitization.rb +120 -94
  194. data/lib/active_record/schema.rb +28 -18
  195. data/lib/active_record/schema_dumper.rb +141 -74
  196. data/lib/active_record/schema_migration.rb +50 -0
  197. data/lib/active_record/scoping/default.rb +64 -57
  198. data/lib/active_record/scoping/named.rb +93 -108
  199. data/lib/active_record/scoping.rb +73 -121
  200. data/lib/active_record/secure_token.rb +38 -0
  201. data/lib/active_record/serialization.rb +7 -5
  202. data/lib/active_record/statement_cache.rb +113 -0
  203. data/lib/active_record/store.rb +173 -15
  204. data/lib/active_record/suppressor.rb +58 -0
  205. data/lib/active_record/table_metadata.rb +68 -0
  206. data/lib/active_record/tasks/database_tasks.rb +313 -0
  207. data/lib/active_record/tasks/mysql_database_tasks.rb +151 -0
  208. data/lib/active_record/tasks/postgresql_database_tasks.rb +110 -0
  209. data/lib/active_record/tasks/sqlite_database_tasks.rb +59 -0
  210. data/lib/active_record/timestamp.rb +42 -24
  211. data/lib/active_record/touch_later.rb +58 -0
  212. data/lib/active_record/transactions.rb +233 -105
  213. data/lib/active_record/type/adapter_specific_registry.rb +130 -0
  214. data/lib/active_record/type/date.rb +7 -0
  215. data/lib/active_record/type/date_time.rb +7 -0
  216. data/lib/active_record/type/hash_lookup_type_map.rb +23 -0
  217. data/lib/active_record/type/internal/abstract_json.rb +29 -0
  218. data/lib/active_record/type/internal/timezone.rb +15 -0
  219. data/lib/active_record/type/serialized.rb +63 -0
  220. data/lib/active_record/type/time.rb +20 -0
  221. data/lib/active_record/type/type_map.rb +64 -0
  222. data/lib/active_record/type.rb +72 -0
  223. data/lib/active_record/type_caster/connection.rb +29 -0
  224. data/lib/active_record/type_caster/map.rb +19 -0
  225. data/lib/active_record/type_caster.rb +7 -0
  226. data/lib/active_record/validations/absence.rb +23 -0
  227. data/lib/active_record/validations/associated.rb +33 -18
  228. data/lib/active_record/validations/length.rb +24 -0
  229. data/lib/active_record/validations/presence.rb +66 -0
  230. data/lib/active_record/validations/uniqueness.rb +128 -68
  231. data/lib/active_record/validations.rb +48 -40
  232. data/lib/active_record/version.rb +5 -7
  233. data/lib/active_record.rb +71 -47
  234. data/lib/rails/generators/active_record/migration/migration_generator.rb +56 -8
  235. data/lib/rails/generators/active_record/migration/templates/create_table_migration.rb +24 -0
  236. data/lib/rails/generators/active_record/migration/templates/migration.rb +28 -16
  237. data/lib/rails/generators/active_record/migration.rb +18 -8
  238. data/lib/rails/generators/active_record/model/model_generator.rb +38 -16
  239. data/lib/rails/generators/active_record/model/templates/application_record.rb +5 -0
  240. data/lib/rails/generators/active_record/model/templates/model.rb +7 -6
  241. data/lib/rails/generators/active_record/model/templates/module.rb +1 -1
  242. data/lib/rails/generators/active_record.rb +3 -11
  243. metadata +188 -134
  244. data/examples/associations.png +0 -0
  245. data/lib/active_record/associations/has_and_belongs_to_many_association.rb +0 -63
  246. data/lib/active_record/associations/join_helper.rb +0 -55
  247. data/lib/active_record/associations/preloader/has_and_belongs_to_many.rb +0 -60
  248. data/lib/active_record/attribute_methods/deprecated_underscore_read.rb +0 -32
  249. data/lib/active_record/connection_adapters/abstract/connection_specification.rb +0 -191
  250. data/lib/active_record/connection_adapters/mysql_adapter.rb +0 -441
  251. data/lib/active_record/connection_adapters/sqlite_adapter.rb +0 -583
  252. data/lib/active_record/dynamic_finder_match.rb +0 -68
  253. data/lib/active_record/dynamic_scope_match.rb +0 -23
  254. data/lib/active_record/fixtures/file.rb +0 -65
  255. data/lib/active_record/identity_map.rb +0 -162
  256. data/lib/active_record/observer.rb +0 -121
  257. data/lib/active_record/serializers/xml_serializer.rb +0 -203
  258. data/lib/active_record/session_store.rb +0 -360
  259. data/lib/active_record/test_case.rb +0 -73
  260. data/lib/rails/generators/active_record/model/templates/migration.rb +0 -15
  261. data/lib/rails/generators/active_record/observer/observer_generator.rb +0 -15
  262. data/lib/rails/generators/active_record/observer/templates/observer.rb +0 -4
  263. data/lib/rails/generators/active_record/session_migration/session_migration_generator.rb +0 -25
  264. data/lib/rails/generators/active_record/session_migration/templates/migration.rb +0 -12
data/CHANGELOG.md CHANGED
@@ -1,1009 +1,2120 @@
1
- ## Rails 3.2.19 (Jul 2, 2014) ##
1
+ ## Rails 5.0.0 (June 30, 2016) ##
2
2
 
3
- * Fix SQL Injection Vulnerability in 'bitstring' quoting.
3
+ * Ensure hashes can be assigned to attributes created using `composed_of`.
4
+ Fixes #25210.
4
5
 
5
- Fixes CVE-2014-3482.
6
+ *Sean Griffin*
6
7
 
7
- *Rafael Mendonça França*
8
+ * Fix logging edge case where if an attribute was of the binary type and
9
+ was provided as a Hash.
10
+
11
+ *Jon Moss*
12
+
13
+ * Handle JSON deserialization correctly if the column default from database
14
+ adapter returns `''` instead of `nil`.
15
+
16
+ *Johannes Opper*
17
+
18
+ * PostgreSQL: Support Expression Indexes and Operator Classes.
19
+
20
+ Example:
21
+
22
+ create_table :users do |t|
23
+ t.string :name
24
+ t.index 'lower(name) varchar_pattern_ops'
25
+ end
26
+
27
+ Fixes #19090, #21765, #21819, #24359.
28
+
29
+ *Ryuta Kamizono*
30
+
31
+ * MySQL: Prepared statements support.
32
+
33
+ To enable, set `prepared_statements: true` in config/database.yml.
34
+ Requires mysql2 0.4.4+.
35
+
36
+ *Ryuta Kamizono*
37
+
38
+ * Schema dumper: Indexes are now included in the `create_table` block
39
+ instead of listed afterward as separate `add_index` lines.
40
+
41
+ This tidies up schema.rb and makes it easy to read as a list of tables.
42
+
43
+ Bonus: Allows databases that support it (MySQL) to perform as single
44
+ `CREATE TABLE` query, no additional query per index.
45
+
46
+ *Ryuta Kamizono*
47
+
48
+ * SQLite: Fix uniqueness validation when values exceed the column limit.
49
+
50
+ SQLite doesn't impose length restrictions on strings, BLOBs, or numeric
51
+ values. It treats them as helpful metadata. When we truncate strings
52
+ before checking uniqueness, we'd miss values that exceed the column limit.
53
+
54
+ Other databases enforce length limits. A large value will pass uniqueness
55
+ validation since the column limit guarantees no value that long exists.
56
+ When we insert the row, it'll raise `ActiveRecord::ValueTooLong` as we
57
+ expect.
58
+
59
+ This fixes edge-case incorrect validation failures for values that exceed
60
+ the column limit but are identical to an existing value *when truncated*.
61
+ Now these will pass validation and raise an exception.
62
+
63
+ *Ryuta Kamizono*
64
+
65
+ * Raise `ActiveRecord::ValueTooLong` when column limits are exceeded.
66
+ Supported by MySQL and PostgreSQL adapters.
67
+
68
+ *Ryuta Kamizono*
69
+
70
+ * Migrations: `#foreign_key` respects `table_name_prefix` and `_suffix`.
71
+
72
+ *Ryuta Kamizono*
73
+
74
+ * SQLite: Force NOT NULL primary keys.
75
+
76
+ From SQLite docs: https://www.sqlite.org/lang_createtable.html
77
+ According to the SQL standard, PRIMARY KEY should always imply NOT
78
+ NULL. Unfortunately, due to a bug in some early versions, this is not
79
+ the case in SQLite. Unless the column is an INTEGER PRIMARY KEY or the
80
+ table is a WITHOUT ROWID table or the column is declared NOT NULL,
81
+ SQLite allows NULL values in a PRIMARY KEY column. SQLite could be
82
+ fixed to conform to the standard, but doing so might break legacy
83
+ applications. Hence, it has been decided to merely document the fact
84
+ that SQLite allowing NULLs in most PRIMARY KEY columns.
85
+
86
+ Now we override column options to explicitly set NOT NULL rather than rely
87
+ on implicit NOT NULL like MySQL and PostgreSQL adapters.
88
+
89
+ *Ryuta Kamizono*
90
+
91
+ * Added notice when a database is successfully created or dropped.
92
+
93
+ Example:
94
+
95
+ $ bin/rails db:create
96
+ Created database 'blog_development'
97
+ Created database 'blog_test'
98
+
99
+ $ bin/rails db:drop
100
+ Dropped database 'blog_development'
101
+ Dropped database 'blog_test'
102
+
103
+ Changed older notices
104
+ `blog_development already exists` to `Database 'blog_development' already exists`.
105
+ and
106
+ `Couldn't drop blog_development` to `Couldn't drop database 'blog_development'`.
107
+
108
+ *bogdanvlviv*
109
+
110
+ * Database comments. Annotate database objects (tables, columns, indexes)
111
+ with comments stored in database metadata. PostgreSQL & MySQL support.
112
+
113
+ create_table :pages, force: :cascade, comment: 'CMS content pages' do |t|
114
+ t.string :path, comment: 'Path fragment of page URL used for routing'
115
+ t.string :locale, comment: 'RFC 3066 locale code of website language section'
116
+ t.index [:path, :locale], comment: 'Look up pages by URI'
117
+ end
118
+
119
+ *Andrey Novikov*
120
+
121
+ * Add `quoted_time` for truncating the date part of a TIME column value.
122
+ This fixes queries on TIME column on MariaDB, as it doesn't ignore the
123
+ date part of the string when it coerces to time.
124
+
125
+ *Ryuta Kamizono*
126
+
127
+ * Properly accept all valid JSON primitives in the JSON data type.
128
+
129
+ Fixes #24234
130
+
131
+ *Sean Griffin*
132
+
133
+ * MariaDB 5.3+ supports microsecond datetime precision.
134
+
135
+ *Jeremy Daer*
136
+
137
+ * Delegate `none?` and `one?`. Now they can be invoked as model class methods.
138
+
139
+ Example:
140
+
141
+ # When no record is found on the table
142
+ Topic.none? # => true
143
+
144
+ # When only one record is found on the table
145
+ Topic.one? # => true
146
+
147
+ *Kenta Shirai*
148
+
149
+ * The form builder now properly displays values when passing a proc form
150
+ default to the attributes API.
151
+
152
+ Fixes #24249.
153
+
154
+ *Sean Griffin*
155
+
156
+ * The schema cache is now cleared after the `db:migrate` task is run.
157
+
158
+ Closes #24273.
159
+
160
+ *Chris Arcand*
161
+
162
+ * MySQL: strict mode respects other SQL modes rather than overwriting them.
163
+ Setting `strict: true` adds `STRICT_ALL_TABLES` to `sql_mode`. Setting
164
+ `strict: false` removes `STRICT_TRANS_TABLES`, `STRICT_ALL_TABLES`, and
165
+ `TRADITIONAL` from `sql_mode`.
166
+
167
+ *Ryuta Kamizono*
168
+
169
+ * Execute default_scope defined by abstract class in the context of subclass.
170
+
171
+ Fixes #23413.
172
+ Fixes #10658.
173
+
174
+ *Mehmet Emin İNAÇ*
175
+
176
+ * Fix an issue when preloading associations with extensions.
177
+ Previously every association with extension methods was transformed into an
178
+ instance dependent scope. This is no longer the case.
179
+
180
+ Fixes #23934.
181
+
182
+ *Yves Senn*
183
+
184
+ * Deprecate `{insert|update|delete}_sql` in `DatabaseStatements`.
185
+ Use the `{insert|update|delete}` public methods instead.
186
+
187
+ *Ryuta Kamizono*
188
+
189
+ * Added a configuration option to have active record raise an ArgumentError
190
+ if the order or limit is ignored in a batch query, rather than logging a
191
+ warning message.
192
+
193
+ *Scott Ringwelski*
194
+
195
+ * Honour the order of the joining model in a `has_many :through` association when eager loading.
196
+
197
+ Example:
198
+
199
+ The below will now follow the order of `by_lines` when eager loading `authors`.
200
+
201
+ class Article < ActiveRecord::Base
202
+ has_many :by_lines, -> { order(:position) }
203
+ has_many :authors, through: :by_lines
204
+ end
205
+
206
+ Fixes #17864.
207
+
208
+ *Yasyf Mohamedali*, *Joel Turkel*
209
+
210
+ * Ensure that the Suppressor runs before validations.
211
+
212
+ This moves the suppressor up to be run before validations rather than after
213
+ validations. There's no reason to validate a record you aren't planning on saving.
214
+
215
+ *Eileen M. Uchitelle*
216
+
217
+ * Save many-to-many objects based on association primary key.
218
+
219
+ Fixes #20995.
220
+
221
+ *himesh-r*
222
+
223
+ * Ensure that mutations of the array returned from `ActiveRecord::Relation#to_a`
224
+ do not affect the original relation, by returning a duplicate array each time.
225
+
226
+ This brings the behavior in line with `CollectionProxy#to_a`, which was
227
+ already more careful.
228
+
229
+ *Matthew Draper*
230
+
231
+ * Fixed `where` for polymorphic associations when passed an array containing different types.
232
+
233
+ Fixes #17011.
234
+
235
+ Example:
236
+
237
+ PriceEstimate.where(estimate_of: [Treasure.find(1), Car.find(2)])
238
+ # => SELECT "price_estimates".* FROM "price_estimates"
239
+ WHERE (("price_estimates"."estimate_of_type" = 'Treasure' AND "price_estimates"."estimate_of_id" = 1)
240
+ OR ("price_estimates"."estimate_of_type" = 'Car' AND "price_estimates"."estimate_of_id" = 2))
241
+
242
+ *Philippe Huibonhoa*
243
+
244
+ * Fix a bug where using `t.foreign_key` twice with the same `to_table` within
245
+ the same table definition would only create one foreign key.
246
+
247
+ *George Millo*
248
+
249
+ * Fix a regression on has many association, where calling a child from parent in child's callback
250
+ results in same child records getting added repeatedly to target.
251
+
252
+ Fixes #13387.
253
+
254
+ *Bogdan Gusiev*, *Jon Hinson*
255
+
256
+ * Rework `ActiveRecord::Relation#last`.
257
+
258
+ 1. Never perform additional SQL on loaded relation
259
+ 2. Use SQL reverse order instead of loading relation if relation doesn't have limit
260
+ 3. Deprecated relation loading when SQL order can not be automatically reversed
261
+
262
+ Topic.order("title").load.last(3)
263
+ # before: SELECT ...
264
+ # after: No SQL
265
+
266
+ Topic.order("title").last
267
+ # before: SELECT * FROM `topics`
268
+ # after: SELECT * FROM `topics` ORDER BY `topics`.`title` DESC LIMIT 1
269
+
270
+ Topic.order("coalesce(author, title)").last
271
+ # before: SELECT * FROM `topics`
272
+ # after: Deprecation Warning for irreversible order
273
+
274
+ *Bogdan Gusiev*
275
+
276
+ * Allow `joins` to be unscoped.
277
+
278
+ Fixes #13775.
279
+
280
+ *Takashi Kokubun*
281
+
282
+ * Add ActiveRecord `#second_to_last` and `#third_to_last` methods.
283
+
284
+ *Brian Christian*
285
+
286
+ * Added `numeric` helper into migrations.
287
+
288
+ Example:
289
+
290
+ create_table(:numeric_types) do |t|
291
+ t.numeric :numeric_type, precision: 10, scale: 2
292
+ end
293
+
294
+ *Mehmet Emin İNAÇ*
295
+
296
+ * Bumped the minimum supported version of PostgreSQL to >= 9.1.
297
+ Both PG 9.0 and 8.4 are past their end of life date:
298
+ http://www.postgresql.org/support/versioning/
299
+
300
+ *Remo Mueller*
301
+
302
+ * `ActiveRecord::Relation#reverse_order` throws `ActiveRecord::IrreversibleOrderError`
303
+ when the order can not be reversed using current trivial algorithm.
304
+ Also raises the same error when `#reverse_order` is called on
305
+ relation without any order and table has no primary key:
306
+
307
+ Topic.order("concat(author_name, title)").reverse_order
308
+ # Before: SELECT `topics`.* FROM `topics` ORDER BY concat(author_name DESC, title) DESC
309
+ # After: raises ActiveRecord::IrreversibleOrderError
310
+ Edge.all.reverse_order
311
+ # Before: SELECT `edges`.* FROM `edges` ORDER BY `edges`.`` DESC
312
+ # After: raises ActiveRecord::IrreversibleOrderError
313
+
314
+ *Bogdan Gusiev*
315
+
316
+ * Improve schema_migrations insertion performance by inserting all versions
317
+ in one INSERT SQL.
318
+
319
+ *Akira Matsuda*, *Naoto Koshikawa*
320
+
321
+ * Using `references` or `belongs_to` in migrations will always add index
322
+ for the referenced column by default, without adding `index: true` option
323
+ to generated migration file. Users can opt out of this by passing
324
+ `index: false`.
325
+
326
+ Fixes #18146.
327
+
328
+ *Matthew Draper*, *Prathamesh Sonpatki*
329
+
330
+ * Run `type` attributes through attributes API type-casting before
331
+ instantiating the corresponding subclass. This makes it possible to define
332
+ custom STI mappings.
333
+
334
+ Fixes #21986.
335
+
336
+ *Yves Senn*
337
+
338
+ * Don't try to quote functions or expressions passed to `:default` option if
339
+ they are passed as procs.
340
+
341
+ This will generate proper query with the passed function or expression for
342
+ the default option, instead of trying to quote it in incorrect fashion.
343
+
344
+ Example:
345
+
346
+ create_table :posts do |t|
347
+ t.datetime :published_at, default: -> { 'NOW()' }
348
+ end
349
+
350
+ *Ryuta Kamizono*
351
+
352
+ * Fix regression when loading fixture files with symbol keys.
353
+
354
+ Fixes #22584.
355
+
356
+ *Yves Senn*
357
+
358
+ * Use `version` column as primary key for schema_migrations table because
359
+ `schema_migrations` versions are guaranteed to be unique.
360
+
361
+ This makes it possible to use `update_attributes` on models that do
362
+ not have a primary key.
363
+
364
+ *Richard Schneeman*
365
+
366
+ * Add short-hand methods for text and blob types in MySQL.
367
+
368
+ In Pg and Sqlite3, `:text` and `:binary` have variable unlimited length.
369
+ But in MySQL, these have limited length for each types (ref #21591, #21619).
370
+ This change adds short-hand methods for each text and blob types.
371
+
372
+ Example:
373
+
374
+ create_table :foos do |t|
375
+ t.tinyblob :tiny_blob
376
+ t.mediumblob :medium_blob
377
+ t.longblob :long_blob
378
+ t.tinytext :tiny_text
379
+ t.mediumtext :medium_text
380
+ t.longtext :long_text
381
+ end
382
+
383
+ *Ryuta Kamizono*
384
+
385
+ * Take into account UTC offset when assigning string representation of
386
+ timestamp with offset specified to attribute of time type.
387
+
388
+ *Andrey Novikov*
389
+
390
+ * When calling `first` with a `limit` argument, return directly from the
391
+ `loaded?` records if available.
392
+
393
+ *Ben Woosley*
394
+
395
+ * Deprecate sending the `offset` argument to `find_nth`. Please use the
396
+ `offset` method on relation instead.
397
+
398
+ *Ben Woosley*
399
+
400
+ * Limit record touching to once per transaction.
401
+
402
+ If you have a parent/grand-parent relation like:
403
+
404
+ Comment belongs_to :message, touch: true
405
+ Message belongs_to :project, touch: true
406
+ Project belongs_to :account, touch: true
407
+
408
+ When the lowest entry(`Comment`) is saved, now, it won't repeat the touch
409
+ call multiple times for the parent records.
410
+
411
+ Related #18606.
412
+
413
+ *arthurnn*
414
+
415
+ * Order the result of `find(ids)` to match the passed array, if the relation
416
+ has no explicit order defined.
417
+
418
+ Fixes #20338.
419
+
420
+ *Miguel Grazziotin*, *Matthew Draper*
421
+
422
+ * Omit default limit values in dumped schema. It's tidier, and if the defaults
423
+ change in the future, we can address that via Migration API Versioning.
424
+
425
+ *Jean Boussier*
426
+
427
+ * Support passing the schema name as a prefix to table name in
428
+ `ConnectionAdapters::SchemaStatements#indexes`. Previously the prefix would
429
+ be considered a full part of the index name, and only the schema in the
430
+ current search path would be considered.
431
+
432
+ *Grey Baker*
433
+
434
+ * Ignore index name in `index_exists?` and `remove_index` when not passed a
435
+ name to check for.
436
+
437
+ *Grey Baker*
438
+
439
+ * Extract support for the legacy `mysql` database adapter from core. It will
440
+ live on in a separate gem for now, but most users should just use `mysql2`.
441
+
442
+ *Abdelkader Boudih*
443
+
444
+ * ApplicationRecord is a new superclass for all app models, analogous to app
445
+ controllers subclassing ApplicationController instead of
446
+ ActionController::Base. This gives apps a single spot to configure app-wide
447
+ model behavior.
448
+
449
+ Newly generated applications have `app/models/application_record.rb`
450
+ present by default.
451
+
452
+ *Genadi Samokovarov*
453
+
454
+ * Version the API presented to migration classes, so we can change parameter
455
+ defaults without breaking existing migrations, or forcing them to be
456
+ rewritten through a deprecation cycle.
457
+
458
+ New migrations specify the Rails version they were written for:
459
+
460
+ class AddStatusToOrders < ActiveRecord::Migration[5.0]
461
+ def change
462
+ # ...
463
+ end
464
+ end
465
+
466
+ *Matthew Draper*, *Ravil Bayramgalin*
467
+
468
+ * Use bind params for `limit` and `offset`. This will generate significantly
469
+ fewer prepared statements for common tasks like pagination. To support this
470
+ change, passing a string containing a comma to `limit` has been deprecated,
471
+ and passing an Arel node to `limit` is no longer supported.
472
+
473
+ Fixes #22250.
474
+
475
+ *Sean Griffin*
476
+
477
+ * Introduce after_{create,update,delete}_commit callbacks.
478
+
479
+ Before:
480
+
481
+ after_commit :add_to_index_later, on: :create
482
+ after_commit :update_in_index_later, on: :update
483
+ after_commit :remove_from_index_later, on: :destroy
484
+
485
+ After:
486
+
487
+ after_create_commit :add_to_index_later
488
+ after_update_commit :update_in_index_later
489
+ after_destroy_commit :remove_from_index_later
490
+
491
+ Fixes #22515.
492
+
493
+ *Genadi Samokovarov*
494
+
495
+ * Respect the column default values for `inheritance_column` when
496
+ instantiating records through the base class.
497
+
498
+ Fixes #17121.
499
+
500
+ Example:
501
+
502
+ # The schema of BaseModel has `t.string :type, default: 'SubType'`
503
+ subtype = BaseModel.new
504
+ assert_equals SubType, subtype.class
505
+
506
+ *Kuldeep Aggarwal*
507
+
508
+ * Fix `rake db:structure:dump` on Postgres when multiple schemas are used.
509
+
510
+ Fixes #22346.
511
+
512
+ *Nick Muerdter*, *ckoenig*
513
+
514
+ * Add schema dumping support for PostgreSQL geometric data types.
515
+
516
+ *Ryuta Kamizono*
517
+
518
+ * Except keys of `build_record`'s argument from `create_scope` in `initialize_attributes`.
519
+
520
+ Fixes #21893.
521
+
522
+ *Yuichiro Kaneko*
523
+
524
+ * Deprecate `connection.tables` on the SQLite3 and MySQL adapters.
525
+ Also deprecate passing arguments to `#tables`.
526
+ And deprecate `table_exists?`.
527
+
528
+ The `#tables` method of some adapters (mysql, mysql2, sqlite3) would return
529
+ both tables and views while others (postgresql) just return tables. To make
530
+ their behavior consistent, `#tables` will return only tables in the future.
531
+
532
+ The `#table_exists?` method would check both tables and views. To make
533
+ their behavior consistent with `#tables`, `#table_exists?` will check only
534
+ tables in the future.
535
+
536
+ *Yuichiro Kaneko*
537
+
538
+ * Improve support for non Active Record objects on `validates_associated`
539
+
540
+ Skipping `marked_for_destruction?` when the associated object does not responds
541
+ to it make easier to validate virtual associations built on top of Active Model
542
+ objects and/or serialized objects that implement a `valid?` instance method.
543
+
544
+ *Kassio Borges*, *Lucas Mazza*
545
+
546
+ * Change connection management middleware to return a new response with
547
+ a body proxy, rather than mutating the original.
548
+
549
+ *Kevin Buchanan*
550
+
551
+ * Make `db:migrate:status` to render `1_some.rb` format migrate files.
552
+
553
+ These files are in `db/migrate`:
554
+
555
+ * 1_valid_people_have_last_names.rb
556
+ * 20150819202140_irreversible_migration.rb
557
+ * 20150823202140_add_admin_flag_to_users.rb
558
+ * 20150823202141_migration_tests.rb
559
+ * 2_we_need_reminders.rb
560
+ * 3_innocent_jointable.rb
561
+
562
+ Before:
563
+
564
+ $ bundle exec rake db:migrate:status
565
+ ...
566
+
567
+ Status Migration ID Migration Name
568
+ --------------------------------------------------
569
+ up 001 ********** NO FILE **********
570
+ up 002 ********** NO FILE **********
571
+ up 003 ********** NO FILE **********
572
+ up 20150819202140 Irreversible migration
573
+ up 20150823202140 Add admin flag to users
574
+ up 20150823202141 Migration tests
575
+
576
+ After:
577
+
578
+ $ bundle exec rake db:migrate:status
579
+ ...
580
+
581
+ Status Migration ID Migration Name
582
+ --------------------------------------------------
583
+ up 001 Valid people have last names
584
+ up 002 We need reminders
585
+ up 003 Innocent jointable
586
+ up 20150819202140 Irreversible migration
587
+ up 20150823202140 Add admin flag to users
588
+ up 20150823202141 Migration tests
589
+
590
+ *Yuichiro Kaneko*
591
+
592
+ * Define `ActiveRecord::Sanitization.sanitize_sql_for_order` and use it inside
593
+ `preprocess_order_args`.
594
+
595
+ *Yuichiro Kaneko*
596
+
597
+ * Allow bigint with default nil for avoiding auto increment primary key.
598
+
599
+ *Ryuta Kamizono*
600
+
601
+ * Remove `DEFAULT_CHARSET` and `DEFAULT_COLLATION` in `MySQLDatabaseTasks`.
602
+
603
+ We should omit the collation entirely rather than providing a default.
604
+ Then the choice is the responsibility of the server and MySQL distribution.
605
+
606
+ *Ryuta Kamizono*
607
+
608
+ * Alias `ActiveRecord::Relation#left_joins` to
609
+ `ActiveRecord::Relation#left_outer_joins`.
610
+
611
+ *Takashi Kokubun*
612
+
613
+ * Use advisory locking to raise a `ConcurrentMigrationError` instead of
614
+ attempting to migrate when another migration is currently running.
615
+
616
+ *Sam Davies*
617
+
618
+ * Added `ActiveRecord::Relation#left_outer_joins`.
619
+
620
+ Example:
621
+
622
+ User.left_outer_joins(:posts)
623
+ # => SELECT "users".* FROM "users" LEFT OUTER JOIN "posts" ON
624
+ "posts"."user_id" = "users"."id"
625
+
626
+ *Florian Thomas*
627
+
628
+ * Support passing an array to `order` for SQL parameter sanitization.
629
+
630
+ *Aaron Suggs*
631
+
632
+ * Avoid disabling errors on the PostgreSQL connection when enabling the
633
+ `standard_conforming_strings` setting. Errors were previously disabled because
634
+ the setting wasn't writable in Postgres 8.1 and didn't exist in earlier
635
+ versions. Now Rails only supports Postgres 8.2+ we're fine to assume the
636
+ setting exists. Disabling errors caused problems when using a connection
637
+ pooling tool like PgBouncer because it's not guaranteed to have the same
638
+ connection between calls to `execute` and it could leave the connection
639
+ with errors disabled.
640
+
641
+ Fixes #22101.
642
+
643
+ *Harry Marr*
644
+
645
+ * Set `scope.reordering_value` to `true` if `:reordering`-values are specified.
646
+
647
+ Fixes #21886.
648
+
649
+ *Hiroaki Izu*
650
+
651
+ * Add support for bidirectional destroy dependencies.
652
+
653
+ Fixes #13609.
654
+
655
+ Example:
656
+
657
+ class Content < ActiveRecord::Base
658
+ has_one :position, dependent: :destroy
659
+ end
660
+
661
+ class Position < ActiveRecord::Base
662
+ belongs_to :content, dependent: :destroy
663
+ end
664
+
665
+ *Seb Jacobs*
666
+
667
+ * Includes HABTM returns correct size now. It's caused by the join dependency
668
+ only instantiates one HABTM object because the join table hasn't a primary key.
669
+
670
+ Fixes #16032.
671
+
672
+ Examples:
673
+
674
+ before:
675
+
676
+ Project.first.salaried_developers.size # => 3
677
+ Project.includes(:salaried_developers).first.salaried_developers.size # => 1
678
+
679
+ after:
680
+
681
+ Project.first.salaried_developers.size # => 3
682
+ Project.includes(:salaried_developers).first.salaried_developers.size # => 3
683
+
684
+ *Bigxiang*
685
+
686
+ * Add option to index errors in nested attributes.
687
+
688
+ For models which have nested attributes, errors within those models will
689
+ now be indexed if `:index_errors` option is set to true when defining a
690
+ `has_many` relationship or by setting the configuration option
691
+ `config.active_record.index_nested_attribute_errors` to true.
692
+
693
+ Example:
694
+
695
+ class Guitar < ActiveRecord::Base
696
+ has_many :tuning_pegs, index_errors: true
697
+ accepts_nested_attributes_for :tuning_pegs
698
+ end
699
+
700
+ class TuningPeg < ActiveRecord::Base
701
+ belongs_to :guitar
702
+ validates_numericality_of :pitch
703
+ end
704
+
705
+ # Before
706
+ guitar.errors["tuning_pegs.pitch"] = ["is not a number"]
707
+
708
+ # After
709
+ guitar.errors["tuning_pegs[1].pitch"] = ["is not a number"]
710
+
711
+ *Michael Probber*, *Terence Sun*
712
+
713
+ * Exit with non-zero status for failed database rake tasks.
714
+
715
+ *Jay Hayes*
716
+
717
+ * Queries such as `Computer.joins(:monitor).group(:status).count` will now be
718
+ interpreted as `Computer.joins(:monitor).group('computers.status').count`
719
+ so that when `Computer` and `Monitor` have both `status` columns we don't
720
+ have conflicts in projection.
721
+
722
+ *Rafael Sales*
723
+
724
+ * Add ability to default to `uuid` as primary key when generating database migrations.
725
+
726
+ Example:
727
+
728
+ config.generators do |g|
729
+ g.orm :active_record, primary_key_type: :uuid
730
+ end
731
+
732
+ *Jon McCartie*
733
+
734
+ * Don't cache arguments in `#find_by` if they are an `ActiveRecord::Relation`.
735
+
736
+ Fixes #20817.
737
+
738
+ *Hiroaki Izu*
739
+
740
+ * Qualify column name inserted by `group` in calculation.
741
+
742
+ Giving `group` an unqualified column name now works, even if the relation
743
+ has `JOIN` with another table which also has a column of the name.
744
+
745
+ *Soutaro Matsumoto*
746
+
747
+ * Don't cache prepared statements containing an IN clause or a SQL literal, as
748
+ these queries will change often and are unlikely to have a cache hit.
749
+
750
+ *Sean Griffin*
751
+
752
+ * Fix `rewhere` in a `has_many` association.
753
+
754
+ Fixes #21955.
755
+
756
+ *Josh Branchaud*, *Kal*
757
+
758
+ * `where` raises ArgumentError on unsupported types.
759
+
760
+ Fixes #20473.
761
+
762
+ *Jake Worth*
763
+
764
+ * Add an immutable string type to help reduce memory usage for apps which do
765
+ not need mutation detection on strings.
766
+
767
+ *Sean Griffin*
768
+
769
+ * Give `ActiveRecord::Relation#update` its own deprecation warning when
770
+ passed an `ActiveRecord::Base` instance.
771
+
772
+ Fixes #21945.
773
+
774
+ *Ted Johansson*
775
+
776
+ * Make it possible to pass `:to_table` when adding a foreign key through
777
+ `add_reference`.
778
+
779
+ Fixes #21563.
8
780
 
781
+ *Yves Senn*
9
782
 
10
- ## Rails 3.2.18 (May 6, 2014) ##
783
+ * No longer pass deprecated option `-i` to `pg_dump`.
11
784
 
12
- * No changes.
785
+ *Paul Sadauskas*
13
786
 
787
+ * Concurrent `AR::Base#increment!` and `#decrement!` on the same record
788
+ are all reflected in the database rather than overwriting each other.
14
789
 
15
- ## Rails 3.2.17 (Feb 18, 2014) ##
790
+ *Bogdan Gusiev*
16
791
 
17
- * No changes.
792
+ * Avoid leaking the first relation we call `first` on, per model.
18
793
 
794
+ Fixes #21921.
19
795
 
20
- ## Rails 3.2.16 (Dec 3, 2013) ##
796
+ *Matthew Draper*, *Jean Boussier*
21
797
 
22
- * No changes.
798
+ * Remove unused `pk_and_sequence_for` in `AbstractMysqlAdapter`.
23
799
 
800
+ *Ryuta Kamizono*
24
801
 
25
- ## Rails 3.2.15 (Oct 16, 2013) ##
802
+ * Allow fixtures files to set the model class in the YAML file itself.
26
803
 
27
- * When calling the method .find_or_initialize_by_* from a collection_proxy
28
- it should set the inverse_of relation even when the entry was found on the db.
804
+ To load the fixtures file `accounts.yml` as the `User` model, use:
29
805
 
30
- *arthurnn*
806
+ _fixture:
807
+ model_class: User
808
+ david:
809
+ name: David
31
810
 
32
- * Callbacks on has_many should access the in memory parent if a inverse_of is set.
811
+ Fixes #9516.
33
812
 
34
- *arthurnn*
813
+ *Roque Pinel*
35
814
 
36
- * Fix `FinderMethods#last` unscoped primary key.
815
+ * Don't require a database connection to load a class which uses acceptance
816
+ validations.
37
817
 
38
- Fixes #11917.
818
+ *Sean Griffin*
39
819
 
40
- *Eugene Kalenkovich*
820
+ * Correctly apply `unscope` when preloading through associations.
41
821
 
42
- * Load fixtures from linked folders.
822
+ *Jimmy Bourassa*
43
823
 
44
- *Kassio Borges*
824
+ * Fixed taking precision into count when assigning a value to timestamp attribute.
45
825
 
46
- * When using optimistic locking, `update` was not passing the column to `quote_value`
47
- to allow the connection adapter to properly determine how to quote the value. This was
48
- affecting certain databases that use specific colmn types.
826
+ Timestamp column can have less precision than ruby timestamp
827
+ In result in how big a fraction of a second can be stored in the
828
+ database.
49
829
 
50
- Fixes: #6763
51
830
 
52
- *Alfred Wong*
831
+ m = Model.create!
832
+ m.created_at.usec == m.reload.created_at.usec # => false
833
+ # due to different precision in Time.now and database column
53
834
 
835
+ If the precision is low enough, (mysql default is 0, so it is always low
836
+ enough by default) the value changes when model is reloaded from the
837
+ database. This patch fixes that issue ensuring that any timestamp
838
+ assigned as an attribute is converted to column precision under the
839
+ attribute.
54
840
 
55
- ## Rails 3.2.14 (Jul 22, 2013) ##
841
+ *Bogdan Gusiev*
56
842
 
57
- * Fix merge error when Equality LHS is non-attribute.
58
- Backport of #7380.
843
+ * Introduce `connection.data_sources` and `connection.data_source_exists?`.
844
+ These methods determine what relations can be used to back Active Record
845
+ models (usually tables and views).
59
846
 
60
- *Karmes Alexander*
847
+ Also deprecate `SchemaCache#tables`, `SchemaCache#table_exists?` and
848
+ `SchemaCache#clear_table_cache!` in favor of their new data source
849
+ counterparts.
61
850
 
62
- * Do not re-create destroyed association when saving the parent object.
851
+ *Yves Senn*, *Matthew Draper*
63
852
 
64
- Fixes #11450.
853
+ * Add `ActiveRecord::Base.ignored_columns` to make some columns
854
+ invisible from Active Record.
65
855
 
66
- *Paul Nikitochkin*
856
+ *Jean Boussier*
67
857
 
68
- * Do not shallow the original exception in `exec_cache` on PostgreSQL adapter.
858
+ * `ActiveRecord::Tasks::MySQLDatabaseTasks` fails if shellout to
859
+ mysql commands (like `mysqldump`) is not successful.
69
860
 
70
- Fixes #11260.
861
+ *Steve Mitchell*
71
862
 
72
- *Rafael Mendonça França*
863
+ * Ensure `select` quotes aliased attributes, even when using `from`.
864
+
865
+ Fixes #21488.
866
+
867
+ *Sean Griffin*, *@johanlunds*
73
868
 
74
- * Fix `ActiveRecord::Store` incorrectly tracking changes of its attributes.
75
- Fixes #10373.
869
+ * MySQL: support `unsigned` numeric data types.
76
870
 
77
- *Janko Marohnić*
871
+ Example:
78
872
 
79
- * Fix a bug that prevented the use of the default STI inheritance column
80
- (ActiveRecord::Base.inheritance_column = 'some_column'.)
873
+ create_table :foos do |t|
874
+ t.unsigned_integer :quantity
875
+ t.unsigned_bigint :total
876
+ t.unsigned_float :percentage
877
+ t.unsigned_decimal :price, precision: 10, scale: 2
878
+ end
81
879
 
82
- *chapmajs + Takehiro Adachi*
880
+ The `unsigned: true` option may be used for the primary key:
83
881
 
84
- * Fix mysql2 adapter raises the correct exception when executing a query on a
85
- closed connection.
882
+ create_table :foos, id: :bigint, unsigned: true do |t|
883
+
884
+ end
86
885
 
87
- *Yves Senn*
886
+ *Ryuta Kamizono*
88
887
 
89
- * Fixes bug where `Company.new.contract_ids` would incorrectly load
90
- all non-associated contracts.
888
+ * Add `#views` and `#view_exists?` methods on connection adapters.
889
+
890
+ *Ryuta Kamizono*
891
+
892
+ * Correctly dump composite primary key.
91
893
 
92
894
  Example:
93
895
 
94
- company = Company.new # Company has many :contracts
896
+ create_table :barcodes, primary_key: ["region", "code"] do |t|
897
+ t.string :region
898
+ t.integer :code
899
+ end
95
900
 
96
- # before
97
- company.contract_ids # => SELECT ... WHERE `contracts`.`company_id` IS NULL
901
+ *Ryuta Kamizono*
98
902
 
99
- # after
100
- company.contract_ids # => []
903
+ * Lookup the attribute name for `restrict_with_error` messages on the
904
+ model class that defines the association.
101
905
 
102
- *Jared Armstrong*
906
+ *kuboon*, *Ronak Jangir*
103
907
 
104
- * Fix the `:primary_key` option for `has_many` associations.
105
- Fixes #10693.
908
+ * Correct query for PostgreSQL 8.2 compatibility.
106
909
 
107
- *Yves Senn*
910
+ *Ben Murphy*, *Matthew Draper*
108
911
 
109
- * fixes bug introduced by #3329. Now, when autosaving associations,
110
- deletions happen before inserts and saves. This prevents a 'duplicate
111
- unique value' database error that would occur if a record being created had
112
- the same value on a unique indexed field as that of a record being destroyed.
912
+ * `bin/rails db:migrate` uses
913
+ `ActiveRecord::Tasks::DatabaseTasks.migrations_paths` instead of
914
+ `Migrator.migrations_paths`.
113
915
 
114
- Backport of #10417
916
+ *Tobias Bielohlawek*
115
917
 
116
- *Johnny Holton*
918
+ * Support dropping indexes concurrently in PostgreSQL.
117
919
 
118
- * Fix that under some conditions, Active Record could produce invalid SQL of the sort:
119
- "SELECT DISTINCT DISTINCT".
920
+ See http://www.postgresql.org/docs/9.4/static/sql-dropindex.html for more
921
+ details.
120
922
 
121
- Backport of #6792.
923
+ *Grey Baker*
122
924
 
123
- *Ben Woosley*
925
+ * Deprecate passing conditions to `ActiveRecord::Relation#delete_all`
926
+ and `ActiveRecord::Relation#destroy_all`.
927
+
928
+ *Wojciech Wnętrzak*
124
929
 
125
- * Require `ActiveRecord::Base` in railtie hooks for rake_tasks, console and runner to
126
- avoid circular constant loading issues.
930
+ * Instantiating an AR model with `ActionController::Parameters` now raises
931
+ an `ActiveModel::ForbiddenAttributesError` if the parameters include a
932
+ `type` field that has not been explicitly permitted. Previously, the
933
+ `type` field was simply ignored in the same situation.
127
934
 
128
- Backport #7695.
935
+ *Prem Sichanugrist*
129
936
 
130
- Fixes #7683 and #882
937
+ * PostgreSQL, `create_schema`, `drop_schema` and `rename_table` now quote
938
+ schema names.
131
939
 
132
- *Ben Holley*
940
+ Fixes #21418.
133
941
 
134
- * Maintain context for joins within ActiveRecord::Relation merges.
135
- Backport #10164.
942
+ Example:
136
943
 
137
- *Neeraj Singh + Andrew Horner*
944
+ create_schema("my.schema")
945
+ # CREATE SCHEMA "my.schema";
138
946
 
139
- * Make sure the `EXPLAIN` command is never triggered by a `select_db` call.
947
+ *Yves Senn*
140
948
 
141
- *Daniel Schierbeck*
949
+ * PostgreSQL, add `:if_exists` option to `#drop_schema`. This makes it
950
+ possible to drop a schema that might exist without raising an exception if
951
+ it doesn't.
142
952
 
143
- * Revert changes on `pluck` that was ignoring the select clause when the relation already
144
- has one. This caused a regression since it changed the behavior in a stable release.
953
+ *Yves Senn*
145
954
 
146
- Fixes #9777.
955
+ * Only try to nullify has_one target association if the record is persisted.
147
956
 
148
- *Rafael Mendonça França*
957
+ Fixes #21223.
149
958
 
150
- * Confirm a record has not already been destroyed before decrementing counter cache.
959
+ *Agis Anastasopoulos*
151
960
 
152
- *Ben Tucker*
961
+ * Uniqueness validator raises descriptive error when running on a persisted
962
+ record without primary key.
153
963
 
154
- * Default values for PostgreSQL bigint types now get parsed and dumped to the
155
- schema correctly.
156
- Backport #10098.
964
+ Fixes #21304.
157
965
 
158
- *Erik Peterson*
966
+ *Yves Senn*
159
967
 
160
- * Removed warning when `auto_explain_threshold_in_seconds` is set and the
161
- connection adapter doesn't support explain.
162
- This is causing a regression since the Active Record Railtie is trying to
163
- connect to the development database in the application boot.
968
+ * Add a native JSON data type support in MySQL.
164
969
 
165
- *Rafael Mendonça França*
970
+ Example:
971
+
972
+ create_table :json_data_type do |t|
973
+ t.json :settings
974
+ end
975
+
976
+ *Ryuta Kamizono*
977
+
978
+ * Descriptive error message when fixtures contain a missing column.
979
+
980
+ Fixes #21201.
981
+
982
+ *Yves Senn*
166
983
 
167
- * Do not reset `inheritance_column` when it's set explicitly.
168
- Backport of #5327.
984
+ * `ActiveRecord::Tasks::PostgreSQLDatabaseTasks` fail if shellout to
985
+ postgresql commands (like `pg_dump`) is not successful.
169
986
 
170
- *kennyj + Fred Wu*
987
+ *Bryan Paxton*, *Nate Berkopec*
171
988
 
172
- * Fix a problem wrong exception is occured
173
- when raising no translatable exception in PostgreSQL.
989
+ * Add `ActiveRecord::Relation#in_batches` to work with records and relations
990
+ in batches.
174
991
 
175
- *kennyj*
992
+ Available options are `of` (batch size), `load`, `start`, and `finish`.
176
993
 
177
- * Resets the postgres search path in the structure.sql after the structure
178
- is dumped in order to find schema_migrations table when multiples schemas
179
- are used.
180
- Fixes #9796.
994
+ Examples:
181
995
 
182
- *Juan M. Cuello + Dembskiy Alexander*
996
+ Person.in_batches.each_record(&:party_all_night!)
997
+ Person.in_batches.update_all(awesome: true)
998
+ Person.in_batches.delete_all
999
+ Person.in_batches.each do |relation|
1000
+ relation.delete_all
1001
+ sleep 10 # Throttles the delete queries
1002
+ end
183
1003
 
184
- * Reload the association target if it's stale. `@stale_state` should be nil
185
- when a model isn't saved.
186
- Fixes #7526.
1004
+ Fixes #20933.
187
1005
 
188
- *Larry Lv*
1006
+ *Sina Siadat*
189
1007
 
190
- * Don't read CSV files during execution of `db:fixtures:load`. CSV support for
191
- fixtures was removed some time ago but the task was still loading them, even
192
- though later the code was looking for the related yaml file instead.
1008
+ * Added methods for PostgreSQL geometric data types to use in migrations.
193
1009
 
194
- *kennyj*
1010
+ Example:
195
1011
 
1012
+ create_table :foo do |t|
1013
+ t.line :foo_line
1014
+ t.lseg :foo_lseg
1015
+ t.box :foo_box
1016
+ t.path :foo_path
1017
+ t.polygon :foo_polygon
1018
+ t.circle :foo_circle
1019
+ end
196
1020
 
197
- ## Rails 3.2.13 (Mar 18, 2013) ##
1021
+ *Mehmet Emin İNAÇ*
198
1022
 
199
- * Chaining multiple preloaded scopes will correctly preload all the scopes
200
- at the same time.
1023
+ * Add `cache_key` to ActiveRecord::Relation.
201
1024
 
202
- *Chris Geihsler*
1025
+ Example:
203
1026
 
204
- * Reverted 921a296a3390192a71abeec6d9a035cc6d1865c8, 'Quote numeric values
205
- compared to string columns.' This caused several regressions.
1027
+ @users = User.where("name like ?", "%Alberto%")
1028
+ @users.cache_key
1029
+ # => "/users/query-5942b155a43b139f2471b872ac54251f-3-20150714212107656125000"
206
1030
 
207
- *Steve Klabnik*
1031
+ *Alberto Fernández-Capel*
208
1032
 
209
- * Fix overriding of attributes by `default_scope` on `ActiveRecord::Base#dup`.
1033
+ * Properly allow uniqueness validations on primary keys.
210
1034
 
211
- *Hiroshige UMINO*
1035
+ Fixes #20966.
212
1036
 
213
- * Fix issue with overriding Active Record reader methods with a composed object
214
- and using that attribute as the scope of a `uniqueness_of` validation.
215
- Backport #7072.
1037
+ *Sean Griffin*, *presskey*
216
1038
 
217
- *Peter Brown*
1039
+ * Don't raise an error if an association failed to destroy when `destroy` was
1040
+ called on the parent (as opposed to `destroy!`).
218
1041
 
219
- * Sqlite now preserves custom primary keys when copying or altering tables.
220
- Fixes #9367.
221
- Backport #2312.
1042
+ Fixes #20991.
222
1043
 
223
- *Sean Scally + Yves Senn*
1044
+ *Sean Griffin*
224
1045
 
225
- * Preloading `has_many :through` associations with conditions won't
226
- cache the `:through` association. This will prevent invalid
227
- subsets to be cached.
228
- Fixes #8423.
229
- Backport #9252.
1046
+ * `ActiveRecord::RecordNotFound` modified to store model name, primary_key and
1047
+ id of the caller model. It allows the catcher of this exception to make
1048
+ a better decision to what to do with it.
230
1049
 
231
1050
  Example:
232
1051
 
233
- class User
234
- has_many :posts
235
- has_many :recent_comments, -> { where('created_at > ?', 1.week.ago) }, :through => :posts
1052
+ class SomeAbstractController < ActionController::Base
1053
+ rescue_from ActiveRecord::RecordNotFound, with: :redirect_to_404
1054
+
1055
+ private def redirect_to_404(e)
1056
+ return redirect_to(posts_url) if e.model == 'Post'
1057
+ raise
1058
+ end
236
1059
  end
237
1060
 
238
- a_user = User.includes(:recent_comments).first
1061
+ *Sameer Rahmani*
1062
+
1063
+ * Deprecate the keys for association `restrict_dependent_destroy` errors in favor
1064
+ of new key names.
1065
+
1066
+ Previously `has_one` and `has_many` associations were using the
1067
+ `one` and `many` keys respectively. Both of these keys have special
1068
+ meaning in I18n (they are considered to be pluralizations) so by
1069
+ renaming them to `has_one` and `has_many` we make the messages more explicit
1070
+ and most importantly they don't clash with linguistical systems that need to
1071
+ validate translation keys (and their pluralizations).
1072
+
1073
+ The `:'restrict_dependent_destroy.one'` key should be replaced with
1074
+ `:'restrict_dependent_destroy.has_one'`, and `:'restrict_dependent_destroy.many'`
1075
+ with `:'restrict_dependent_destroy.has_many'`.
1076
+
1077
+ *Roque Pinel*, *Christopher Dell*
1078
+
1079
+ * Fix state being carried over from previous transaction.
1080
+
1081
+ Considering the following example where `name` is a required attribute.
1082
+ Before we had `new_record?` returning `true` for a persisted record:
1083
+
1084
+ author = Author.create! name: 'foo'
1085
+ author.name = nil
1086
+ author.save # => false
1087
+ author.new_record? # => true
1088
+
1089
+ Fixes #20824.
1090
+
1091
+ *Roque Pinel*
1092
+
1093
+ * Correctly ignore `mark_for_destruction` when `autosave` isn't set to `true`
1094
+ when validating associations.
1095
+
1096
+ Fixes #20882.
1097
+
1098
+ *Sean Griffin*
1099
+
1100
+ * Fix a bug where counter_cache doesn't always work with polymorphic
1101
+ relations.
1102
+
1103
+ Fixes #16407.
1104
+
1105
+ *Stefan Kanev*, *Sean Griffin*
1106
+
1107
+ * Ensure that cyclic associations with autosave don't cause duplicate errors
1108
+ to be added to the parent record.
1109
+
1110
+ Fixes #20874.
1111
+
1112
+ *Sean Griffin*
1113
+
1114
+ * Ensure that `ActionController::Parameters` can still be passed to nested
1115
+ attributes.
1116
+
1117
+ Fixes #20922.
1118
+
1119
+ *Sean Griffin*
1120
+
1121
+ * Deprecate force association reload by passing a truthy argument to
1122
+ association method.
1123
+
1124
+ For collection association, you can call `#reload` on association proxy to
1125
+ force a reload:
1126
+
1127
+ @user.posts.reload # Instead of @user.posts(true)
1128
+
1129
+ For singular association, you can call `#reload` on the parent object to
1130
+ clear its association cache then call the association method:
1131
+
1132
+ @user.reload.profile # Instead of @user.profile(true)
239
1133
 
240
- # this is preloaded
241
- a_user.recent_comments
1134
+ Passing a truthy argument to force association to reload will be removed in
1135
+ Rails 5.1.
242
1136
 
243
- # fetching the recent_comments through the posts association won't preload it.
244
- a_user.posts
1137
+ *Prem Sichanugrist*
1138
+
1139
+ * Replaced `ActiveSupport::Concurrency::Latch` with `Concurrent::CountDownLatch`
1140
+ from the concurrent-ruby gem.
1141
+
1142
+ *Jerry D'Antonio*
1143
+
1144
+ * Fix through associations using scopes having the scope merged multiple
1145
+ times.
1146
+
1147
+ Fixes #20721.
1148
+ Fixes #20727.
1149
+
1150
+ *Sean Griffin*
1151
+
1152
+ * `ActiveRecord::Base.dump_schema_after_migration` applies migration tasks
1153
+ other than `db:migrate`. (eg. `db:rollback`, `db:migrate:dup`, ...)
1154
+
1155
+ Fixes #20743.
245
1156
 
246
1157
  *Yves Senn*
247
1158
 
248
- * Fix handling of dirty time zone aware attributes
1159
+ * Add alternate syntax to make `change_column_default` reversible.
249
1160
 
250
- Previously, when `time_zone_aware_attributes` were enabled, after
251
- changing a datetime or timestamp attribute and then changing it back
252
- to the original value, `changed_attributes` still tracked the
253
- attribute as changed. This caused `[attribute]_changed?` and
254
- `changed?` methods to return true incorrectly.
1161
+ User can pass in `:from` and `:to` to make `change_column_default` command
1162
+ become reversible.
255
1163
 
256
1164
  Example:
257
1165
 
258
- in_time_zone 'Paris' do
259
- order = Order.new
260
- original_time = Time.local(2012, 10, 10)
261
- order.shipped_at = original_time
262
- order.save
263
- order.changed? # => false
1166
+ change_column_default :posts, :status, from: nil, to: "draft"
1167
+ change_column_default :users, :authorized, from: true, to: false
264
1168
 
265
- # changing value
266
- order.shipped_at = Time.local(2013, 1, 1)
267
- order.changed? # => true
1169
+ *Prem Sichanugrist*
268
1170
 
269
- # reverting to original value
270
- order.shipped_at = original_time
271
- order.changed? # => false, used to return true
272
- end
1171
+ * Prevent error when using `force_reload: true` on an unassigned polymorphic
1172
+ belongs_to association.
273
1173
 
274
- Backport of #9073
275
- Fixes #8898
1174
+ Fixes #20426.
276
1175
 
277
- *Lilibeth De La Cruz*
1176
+ *James Dabbs*
278
1177
 
279
- * Fix counter cache columns not updated when replacing `has_many :through`
280
- associations.
281
- Backport #8400.
282
- Fix #7630.
1178
+ * Correctly raise `ActiveRecord::AssociationTypeMismatch` when assigning
1179
+ a wrong type to a namespaced association.
1180
+
1181
+ Fixes #20545.
1182
+
1183
+ *Diego Carrion*
1184
+
1185
+ * `validates_absence_of` respects `marked_for_destruction?`.
1186
+
1187
+ Fixes #20449.
1188
+
1189
+ *Yves Senn*
1190
+
1191
+ * Include the `Enumerable` module in `ActiveRecord::Relation`
1192
+
1193
+ *Sean Griffin*, *bogdan*
1194
+
1195
+ * Use `Enumerable#sum` in `ActiveRecord::Relation` if a block is given.
1196
+
1197
+ *Sean Griffin*
1198
+
1199
+ * Let `WITH` queries (Common Table Expressions) be explainable.
1200
+
1201
+ *Vladimir Kochnev*
1202
+
1203
+ * Make `remove_index :table, :column` reversible.
1204
+
1205
+ *Yves Senn*
1206
+
1207
+ * Fixed an error which would occur in dirty checking when calling
1208
+ `update_attributes` from a getter.
1209
+
1210
+ Fixes #20531.
1211
+
1212
+ *Sean Griffin*
1213
+
1214
+ * Make `remove_foreign_key` reversible. Any foreign key options must be
1215
+ specified, similar to `remove_column`.
1216
+
1217
+ *Aster Ryan*
1218
+
1219
+ * Add `:_prefix` and `:_suffix` options to `enum` definition.
1220
+
1221
+ Fixes #17511, #17415.
1222
+
1223
+ *Igor Kapkov*
283
1224
 
284
- *Matthew Robertson*
1225
+ * Correctly handle decimal arrays with defaults in the schema dumper.
285
1226
 
286
- * Don't update `column_defaults` when calling destructive methods on column with default value.
287
- Backport c517602.
288
- Fix #6115.
1227
+ Fixes #20515.
289
1228
 
290
- *Piotr Sarnacki + Aleksey Magusev + Alan Daud*
1229
+ *Sean Griffin*, *jmondo*
291
1230
 
292
- * When `#count` is used in conjunction with `#uniq` we perform `count(:distinct => true)`.
293
- Fix #6865.
1231
+ * Deprecate the PostgreSQL `:point` type in favor of a new one which will return
1232
+ `Point` objects instead of an `Array`
1233
+
1234
+ *Sean Griffin*
1235
+
1236
+ * Ensure symbols passed to `ActiveRecord::Relation#select` are always treated
1237
+ as columns.
1238
+
1239
+ Fixes #20360.
1240
+
1241
+ *Sean Griffin*
1242
+
1243
+ * Do not set `sql_mode` if `strict: :default` is specified.
1244
+
1245
+ # config/database.yml
1246
+ production:
1247
+ adapter: mysql2
1248
+ database: foo_prod
1249
+ user: foo
1250
+ strict: :default
1251
+
1252
+ *Ryuta Kamizono*
1253
+
1254
+ * Allow proc defaults to be passed to the attributes API. See documentation
1255
+ for examples.
1256
+
1257
+ *Sean Griffin*, *Kir Shatrov*
1258
+
1259
+ * SQLite: `:collation` support for string and text columns.
294
1260
 
295
1261
  Example:
296
1262
 
297
- relation.uniq.count # => SELECT COUNT(DISTINCT *)
1263
+ create_table :foo do |t|
1264
+ t.string :string_nocase, collation: 'NOCASE'
1265
+ t.text :text_rtrim, collation: 'RTRIM'
1266
+ end
298
1267
 
299
- *Yves Senn + Kaspar Schiess*
1268
+ add_column :foo, :title, :string, collation: 'RTRIM'
300
1269
 
301
- * Fix `ActiveRecord::Relation#pluck` when columns or tables are reserved words.
302
- Backport #7536.
303
- Fix #8968.
1270
+ change_column :foo, :title, :string, collation: 'NOCASE'
304
1271
 
305
- *Ian Lesperance + Yves Senn + Kaspar Schiess*
1272
+ *Akshay Vishnoi*
306
1273
 
307
- * Don't run explain on slow queries for database adapters that don't support it.
308
- Backport #6197.
1274
+ * Allow the use of symbols or strings to specify enum values in test
1275
+ fixtures:
309
1276
 
310
- *Blake Smith*
1277
+ awdr:
1278
+ title: "Agile Web Development with Rails"
1279
+ status: :proposed
311
1280
 
312
- * Revert round usec when comparing timestamp attributes in the dirty tracking.
313
- Fixes #8460.
1281
+ *George Claghorn*
314
1282
 
315
- *Andrew White*
1283
+ * Clear query cache when `ActiveRecord::Base#reload` is called.
316
1284
 
317
- * Revert creation of through association models when using `collection=[]`
318
- on a `has_many :through` association from an unsaved model.
319
- Fix #7661, #8269.
1285
+ *Shane Hender, Pierre Nespo*
320
1286
 
321
- *Ernie Miller*
1287
+ * Include stored procedures and function on the MySQL structure dump.
322
1288
 
323
- * Fix undefined method `to_i` when calling `new` on a scope that uses an
324
- Array; Fix FloatDomainError when setting integer column to NaN.
325
- Fixes #8718, #8734, #8757.
1289
+ *Jonathan Worek*
326
1290
 
327
- *Jason Stirk + Tristan Harward*
1291
+ * Pass `:extend` option for `has_and_belongs_to_many` associations to the
1292
+ underlying `has_many :through`.
328
1293
 
329
- * Serialized attributes can be serialized in integer columns.
330
- Fix #8575.
1294
+ *Jaehyun Shin*
331
1295
 
332
- *Rafael Mendonça França*
1296
+ * Deprecate `Relation#uniq` use `Relation#distinct` instead.
333
1297
 
334
- * Keep index names when using `alter_table` with sqlite3.
335
- Fix #3489.
336
- Backport #8522.
1298
+ See #9683.
337
1299
 
338
1300
  *Yves Senn*
339
1301
 
340
- * Recognize migrations placed in directories containing numbers and 'rb'.
341
- Fix #8492.
342
- Backport of #8500.
1302
+ * Allow single table inheritance instantiation to work when storing
1303
+ demodulized class names.
343
1304
 
344
- *Yves Senn*
1305
+ *Alex Robbin*
345
1306
 
346
- * Add `ActiveRecord::Base.cache_timestamp_format` class attribute to control
347
- the format of the timestamp value in the cache key.
348
- This allows users to improve the precision of the cache key.
349
- Fixes #8195.
1307
+ * Correctly pass MySQL options when using `structure_dump` or
1308
+ `structure_load`.
350
1309
 
351
- *Rafael Mendonça França*
1310
+ Specifically, it fixes an issue when using SSL authentication.
1311
+
1312
+ *Alex Coomans*
352
1313
 
353
- * Add `:nsec` date format. This can be used to improve the precision of cache key.
354
- Please note that this format only works with Ruby 1.9, Ruby 1.8 will ignore it completely.
1314
+ * Correctly dump `:options` on `create_table` for MySQL.
355
1315
 
356
- *Jamie Gaskins*
1316
+ *Ryuta Kamizono*
357
1317
 
358
- * Unscope `update_column(s)` query to ignore default scope.
1318
+ * PostgreSQL: `:collation` support for string and text columns.
359
1319
 
360
- When applying `default_scope` to a class with a where clause, using
361
- `update_column(s)` could generate a query that would not properly update
362
- the record due to the where clause from the `default_scope` being applied
363
- to the update query.
1320
+ Example:
364
1321
 
365
- class User < ActiveRecord::Base
366
- default_scope where(active: true)
1322
+ create_table :foos do |t|
1323
+ t.string :string_en, collation: 'en_US.UTF-8'
1324
+ t.text :text_ja, collation: 'ja_JP.UTF-8'
367
1325
  end
368
1326
 
369
- user = User.first
370
- user.active = false
371
- user.save!
1327
+ *Ryuta Kamizono*
372
1328
 
373
- user.update_column(:active, true) # => false
1329
+ * Remove `ActiveRecord::Serialization::XmlSerializer` from core.
374
1330
 
375
- In this situation we want to skip the default_scope clause and just
376
- update the record based on the primary key. With this change:
1331
+ *Zachary Scott*
377
1332
 
378
- user.update_column(:active, true) # => true
1333
+ * Make `unscope` aware of "less than" and "greater than" conditions.
379
1334
 
380
- Backport of #8436 fix.
1335
+ *TAKAHASHI Kazuaki*
381
1336
 
382
- *Carlos Antonio da Silva*
1337
+ * `find_by` and `find_by!` raise `ArgumentError` when called without
1338
+ arguments.
383
1339
 
384
- * Fix performance problem with primary_key method in PostgreSQL adapter when having many schemas.
385
- Uses pg_constraint table instead of pg_depend table which has many records in general.
386
- Fix #8414
1340
+ *Kohei Suzuki*
387
1341
 
388
- *kennyj*
1342
+ * Revert behavior of `db:schema:load` back to loading the full
1343
+ environment. This ensures that initializers are run.
389
1344
 
390
- * Do not instantiate intermediate Active Record objects when eager loading.
391
- These records caused `after_find` to run more than expected.
392
- Fix #3313
393
- Backport of #8403
1345
+ Fixes #19545.
394
1346
 
395
1347
  *Yves Senn*
396
1348
 
397
- * Fix `pluck` to work with joins. Backport of #4942.
1349
+ * Fix missing index when using `timestamps` with the `index` option.
1350
+
1351
+ The `index` option used with `timestamps` should be passed to both
1352
+ `column` definitions for `created_at` and `updated_at` rather than just
1353
+ the first.
398
1354
 
399
- *Carlos Antonio da Silva*
1355
+ *Paul Mucur*
400
1356
 
401
- * Fix a problem with `translate_exception` method in a non English environment.
402
- Backport of #6397.
1357
+ * Rename `:class` to `:anonymous_class` in association options.
403
1358
 
404
- *kennyj*
1359
+ Fixes #19659.
405
1360
 
406
- * Fix dirty attribute checks for TimeZoneConversion with nil and blank
407
- datetime attributes. Setting a nil datetime to a blank string should not
408
- result in a change being flagged.
409
- Fixes #8310.
410
- Backport of #8311.
1361
+ *Andrew White*
411
1362
 
412
- *Alisdair McDiarmid*
1363
+ * Autosave existing records on a has many through association when the parent
1364
+ is new.
413
1365
 
414
- * Prevent mass assignment to the type column of polymorphic associations when using `build`.
415
- Fixes #8265.
416
- Backport of #8291.
1366
+ Fixes #19782.
417
1367
 
418
- *Yves Senn*
1368
+ *Sean Griffin*
419
1369
 
420
- * When running migrations on Postgresql, the `:limit` option for `binary` and `text` columns is
421
- silently dropped.
422
- Previously, these migrations caused sql exceptions, because Postgresql doesn't support limits
423
- on these types.
1370
+ * Fixed a bug where uniqueness validations would error on out of range values,
1371
+ even if an validation should have prevented it from hitting the database.
424
1372
 
425
- *Victor Costan*
1373
+ *Andrey Voronkov*
426
1374
 
427
- * `#pluck` can be used on a relation with `select` clause.
428
- Fixes #7551.
429
- Backport of #8176.
1375
+ * MySQL: `:charset` and `:collation` support for string and text columns.
430
1376
 
431
1377
  Example:
432
1378
 
433
- Topic.select([:approved, :id]).order(:id).pluck(:id)
1379
+ create_table :foos do |t|
1380
+ t.string :string_utf8_bin, charset: 'utf8', collation: 'utf8_bin'
1381
+ t.text :text_ascii, charset: 'ascii'
1382
+ end
434
1383
 
435
- *Yves Senn*
1384
+ *Ryuta Kamizono*
1385
+
1386
+ * Foreign key related methods in the migration DSL respect
1387
+ `ActiveRecord::Base.pluralize_table_names = false`.
1388
+
1389
+ Fixes #19643.
1390
+
1391
+ *Mehmet Emin İNAÇ*
1392
+
1393
+ * Reduce memory usage from loading types on PostgreSQL.
1394
+
1395
+ Fixes #19578.
1396
+
1397
+ *Sean Griffin*
1398
+
1399
+ * Add `config.active_record.warn_on_records_fetched_greater_than` option.
1400
+
1401
+ When set to an integer, a warning will be logged whenever a result set
1402
+ larger than the specified size is returned by a query.
1403
+
1404
+ Fixes #16463.
1405
+
1406
+ *Jason Nochlin*
436
1407
 
437
- * Use `nil?` instead of `blank?` to check whether dynamic finder with a bang
438
- should raise RecordNotFound.
439
- Fixes #7238.
1408
+ * Ignore `.psqlrc` when loading database structure.
440
1409
 
441
- *Nikita Afanasenko*
1410
+ *Jason Weathered*
442
1411
 
443
- * Fix deleting from a HABTM join table upon destroying an object of a model
444
- with optimistic locking enabled.
445
- Fixes #5332.
1412
+ * Fix referencing wrong table aliases while joining tables of has many through
1413
+ association (only when calling calculation methods).
446
1414
 
447
- *Nick Rogers*
1415
+ Fixes #19276.
448
1416
 
449
- * Use query cache/uncache when using ENV["DATABASE_URL"].
450
- Fixes #6951.
451
- Backport of #8074.
1417
+ *pinglamb*
452
1418
 
453
- *kennyj*
1419
+ * Correctly persist a serialized attribute that has been returned to
1420
+ its default value by an in-place modification.
454
1421
 
455
- * Do not create useless database transaction when building `has_one` association.
1422
+ Fixes #19467.
1423
+
1424
+ *Matthew Draper*
1425
+
1426
+ * Fix generating the schema file when using PostgreSQL `BigInt[]` data type.
1427
+ Previously the `limit: 8` was not coming through, and this caused it to
1428
+ become `Int[]` data type after rebuilding from the schema.
1429
+
1430
+ Fixes #19420.
1431
+
1432
+ *Jake Waller*
1433
+
1434
+ * Reuse the `CollectionAssociation#reader` cache when the foreign key is
1435
+ available prior to save.
1436
+
1437
+ *Ben Woosley*
1438
+
1439
+ * Add `config.active_record.dump_schemas` to fix `db:structure:dump`
1440
+ when using schema_search_path and PostgreSQL extensions.
1441
+
1442
+ Fixes #17157.
1443
+
1444
+ *Ryan Wallace*
1445
+
1446
+ * Renaming `use_transactional_fixtures` to `use_transactional_tests` for clarity.
1447
+
1448
+ Fixes #18864.
1449
+
1450
+ *Brandon Weiss*
1451
+
1452
+ * Increase pg gem version requirement to `~> 0.18`. Earlier versions of the
1453
+ pg gem are known to have problems with Ruby 2.2.
1454
+
1455
+ *Matt Brictson*
1456
+
1457
+ * Correctly dump `serial` and `bigserial`.
1458
+
1459
+ *Ryuta Kamizono*
1460
+
1461
+ * Fix default `format` value in `ActiveRecord::Tasks::DatabaseTasks#schema_file`.
1462
+
1463
+ *James Cox*
1464
+
1465
+ * Don't enroll records in the transaction if they don't have commit callbacks.
1466
+ This was causing a memory leak when creating many records inside a transaction.
1467
+
1468
+ Fixes #15549.
1469
+
1470
+ *Will Bryant*, *Aaron Patterson*
1471
+
1472
+ * Correctly create through records when created on a has many through
1473
+ association when using `where`.
1474
+
1475
+ Fixes #19073.
1476
+
1477
+ *Sean Griffin*
1478
+
1479
+ * Add `SchemaMigration.create_table` support for any unicode charsets with MySQL.
1480
+
1481
+ *Ryuta Kamizono*
1482
+
1483
+ * PostgreSQL no longer disables user triggers if system triggers can't be
1484
+ disabled. Disabling user triggers does not fulfill what the method promises.
1485
+ Rails currently requires superuser privileges for this method.
1486
+
1487
+ If you absolutely rely on this behavior, consider patching
1488
+ `disable_referential_integrity`.
1489
+
1490
+ *Yves Senn*
1491
+
1492
+ * Restore aborted transaction state when `disable_referential_integrity` fails
1493
+ due to missing permissions.
1494
+
1495
+ *Toby Ovod-Everett*, *Yves Senn*
1496
+
1497
+ * In PostgreSQL, print a warning message if `disable_referential_integrity`
1498
+ fails due to missing permissions.
1499
+
1500
+ *Andrey Nering*, *Yves Senn*
1501
+
1502
+ * Allow a `:limit` option for MySQL bigint primary key support.
456
1503
 
457
1504
  Example:
458
1505
 
459
- User.has_one :profile
460
- User.new.build_profile
1506
+ create_table :foos, id: :primary_key, limit: 8 do |t|
1507
+ end
461
1508
 
462
- Backport of #8154.
1509
+ # or
463
1510
 
464
- *Bogdan Gusiev*
1511
+ create_table :foos, id: false do |t|
1512
+ t.primary_key :id, limit: 8
1513
+ end
465
1514
 
466
- * `AR::Base#attributes_before_type_cast` now returns unserialized values for serialized attributes.
1515
+ *Ryuta Kamizono*
467
1516
 
468
- *Nikita Afanasenko*
1517
+ * `belongs_to` will now trigger a validation error by default if the association is not present.
1518
+ You can turn this off on a per-association basis with `optional: true`.
1519
+ (Note this new default only applies to new Rails apps that will be generated with
1520
+ `config.active_record.belongs_to_required_by_default = true` in initializer.)
469
1521
 
470
- * Fix issue that raises `NameError` when overriding the `accepts_nested_attributes` in child classes.
1522
+ *Josef Šimánek*
471
1523
 
472
- Before:
1524
+ * Fixed `ActiveRecord::Relation#becomes!` and `changed_attributes` issues for type
1525
+ columns.
473
1526
 
474
- class Shared::Person < ActiveRecord::Base
475
- has_one :address
1527
+ Fixes #17139.
476
1528
 
477
- accepts_nested_attributes :address, :reject_if => :all_blank
1529
+ *Miklos Fazekas*
1530
+
1531
+ * Format the time string according to the precision of the time column.
1532
+
1533
+ *Ryuta Kamizono*
1534
+
1535
+ * Allow a `:precision` option for time type columns.
1536
+
1537
+ *Ryuta Kamizono*
1538
+
1539
+ * Add `ActiveRecord::Base.suppress` to prevent the receiver from being saved
1540
+ during the given block.
1541
+
1542
+ For example, here's a pattern of creating notifications when new comments
1543
+ are posted. (The notification may in turn trigger an email, a push
1544
+ notification, or just appear in the UI somewhere):
1545
+
1546
+ class Comment < ActiveRecord::Base
1547
+ belongs_to :commentable, polymorphic: true
1548
+ after_create -> { Notification.create! comment: self,
1549
+ recipients: commentable.recipients }
478
1550
  end
479
1551
 
480
- class Person < Shared::Person
481
- accepts_nested_attributes :address
1552
+ That's what you want the bulk of the time. A new comment creates a new
1553
+ Notification. There may be edge cases where you don't want that, like
1554
+ when copying a commentable and its comments, in which case write a
1555
+ concern with something like this:
1556
+
1557
+ module Copyable
1558
+ def copy_to(destination)
1559
+ Notification.suppress do
1560
+ # Copy logic that creates new comments that we do not want triggering
1561
+ # notifications.
1562
+ end
1563
+ end
482
1564
  end
483
1565
 
484
- Person
485
- #=> NameError: method `address_attributes=' not defined in Person
1566
+ *Michael Ryan*
486
1567
 
487
- After:
1568
+ * `:time` option added for `#touch`.
1569
+
1570
+ Fixes #18905.
1571
+
1572
+ *Hyonjee Joo*
1573
+
1574
+ * Add `foreign_key_exists?` method.
1575
+
1576
+ *Tõnis Simo*
1577
+
1578
+ * Use SQL COUNT and LIMIT 1 queries for `none?` and `one?` methods
1579
+ if no block or limit is given, instead of loading the entire
1580
+ collection into memory. This applies to relations (e.g. `User.all`)
1581
+ as well as associations (e.g. `account.users`)
488
1582
 
489
- Person
490
- #=> Person(id: integer, ...)
1583
+ # Before:
491
1584
 
492
- Fixes #8131.
1585
+ users.none?
1586
+ # SELECT "users".* FROM "users"
493
1587
 
494
- *Gabriel Sobrinho, Ricardo Henrique*
1588
+ users.one?
1589
+ # SELECT "users".* FROM "users"
495
1590
 
1591
+ # After:
496
1592
 
497
- ## Rails 3.2.12 (Feb 11, 2013) ##
1593
+ users.none?
1594
+ # SELECT 1 AS one FROM "users" LIMIT 1
498
1595
 
499
- * Quote numeric values being compared to non-numeric columns. Otherwise,
500
- in some database, the string column values will be coerced to a numeric
501
- allowing 0, 0.0 or false to match any string starting with a non-digit.
1596
+ users.one?
1597
+ # SELECT COUNT(*) FROM "users"
1598
+
1599
+ *Eugene Gilburg*
1600
+
1601
+ * Have `enum` perform type casting consistently with the rest of Active
1602
+ Record, such as `where`.
1603
+
1604
+ *Sean Griffin*
1605
+
1606
+ * `scoping` no longer pollutes the current scope of sibling classes when using
1607
+ STI.
1608
+
1609
+ Fixes #18806.
502
1610
 
503
1611
  Example:
504
1612
 
505
- App.where(apikey: 0) # => SELECT * FROM users WHERE apikey = '0'
1613
+ StiOne.none.scoping do
1614
+ StiTwo.all
1615
+ end
1616
+
506
1617
 
507
- *Dylan Smith*
1618
+ *Sean Griffin*
508
1619
 
1620
+ * `remove_reference` with `foreign_key: true` removes the foreign key before
1621
+ removing the column. This fixes a bug where it was not possible to remove
1622
+ the column on MySQL.
509
1623
 
510
- ## Rails 3.2.11 (Jan 8, 2013) ##
1624
+ Fixes #18664.
511
1625
 
512
- * Fix querying with an empty hash *Damien Mathieu* [CVE-2013-0155]
1626
+ *Yves Senn*
513
1627
 
1628
+ * `find_in_batches` now accepts an `:finish` parameter that complements the `:start`
1629
+ parameter to specify where to stop batch processing.
514
1630
 
515
- ## Rails 3.2.10 (Jan 2, 2013) ##
1631
+ *Vipul A M*
516
1632
 
517
- * CVE-2012-5664 options hashes should only be extracted if there are extra
518
- parameters
1633
+ * Fix a rounding problem for PostgreSQL timestamp columns.
519
1634
 
1635
+ If a timestamp column has a precision specified, it needs to
1636
+ format according to that.
520
1637
 
521
- ## Rails 3.2.9 (Nov 12, 2012) ##
1638
+ *Ryuta Kamizono*
522
1639
 
523
- * Fix `find_in_batches` crashing when IDs are strings and start option is not specified.
1640
+ * Respect the database default charset for `schema_migrations` table.
524
1641
 
525
- *Alexis Bernard*
1642
+ The charset of `version` column in `schema_migrations` table depends
1643
+ on the database default charset and collation rather than the encoding
1644
+ of the connection.
526
1645
 
527
- * Fix issue with collection associations calling first(n)/last(n) and attempting
528
- to set the inverse association when `:inverse_of` was used. Fixes #8087.
1646
+ *Ryuta Kamizono*
529
1647
 
530
- *Carlos Antonio da Silva*
1648
+ * Raise `ArgumentError` when passing `nil` or `false` to `Relation#merge`.
531
1649
 
532
- * Fix bug when Column is trying to type cast boolean values to integer.
533
- Fixes #8067.
1650
+ These are not valid values to merge in a relation, so it should warn users
1651
+ early.
534
1652
 
535
1653
  *Rafael Mendonça França*
536
1654
 
537
- * Fix bug where `rake db:test:prepare` tries to load the structure.sql into development database.
538
- Fixes #8032.
1655
+ * Use `SCHEMA` instead of `DB_STRUCTURE` for specifying a structure file.
539
1656
 
540
- *Grace Liu + Rafael Mendonça França*
1657
+ This makes the `db:structure` tasks consistent with `test:load_structure`.
541
1658
 
542
- * Fixed support for `DATABASE_URL` environment variable for rake db tasks. *Grace Liu*
1659
+ *Dieter Komendera*
543
1660
 
544
- * Fix bug where `update_columns` and `update_column` would not let you update the primary key column.
1661
+ * Respect custom primary keys for associations when calling `Relation#where`
545
1662
 
546
- *Henrik Nyh*
1663
+ Fixes #18813.
547
1664
 
548
- * Decode URI encoded attributes on database connection URLs.
1665
+ *Sean Griffin*
549
1666
 
550
- *Shawn Veader*
1667
+ * Fix several edge cases which could result in a counter cache updating
1668
+ twice or not updating at all for `has_many` and `has_many :through`.
551
1669
 
552
- * Fix AR#dup to nullify the validation errors in the dup'ed object. Previously the original
553
- and the dup'ed object shared the same errors.
1670
+ Fixes #10865.
554
1671
 
555
- *Christian Seiler*
1672
+ *Sean Griffin*
556
1673
 
557
- * Synchronize around deleting from the reserved connections hash.
558
- Fixes #7955
1674
+ * Foreign keys added by migrations were given random, generated names. This
1675
+ meant a different `structure.sql` would be generated every time a developer
1676
+ ran migrations on their machine.
559
1677
 
560
- * PostgreSQL adapter correctly fetches default values when using
561
- multiple schemas and domains in a db. Fixes #7914
1678
+ The generated part of foreign key names is now a hash of the table name and
1679
+ column name, which is consistent every time you run the migration.
562
1680
 
563
- *Arturo Pie*
1681
+ *Chris Sinjakli*
564
1682
 
565
- * Fix deprecation notice when loading a collection association that
566
- selects columns from other tables, if a new record was previously
567
- built using that association.
1683
+ * Fix n+1 query problem when eager loading nil associations (fixes #18312)
568
1684
 
569
- *Ernie Miller*
1685
+ *Sammy Larbi*
570
1686
 
571
- * The postgres adapter now supports tables with capital letters.
572
- Fix #5920
1687
+ * Change the default error message from `can't be blank` to `must exist` for
1688
+ the presence validator of the `:required` option on `belongs_to`/`has_one`
1689
+ associations.
573
1690
 
574
- *Yves Senn*
1691
+ *Henrik Nygren*
575
1692
 
576
- * `CollectionAssociation#count` returns `0` without querying if the
577
- parent record is not persisted.
1693
+ * Fixed `ActiveRecord::Relation#group` method when an argument is an SQL
1694
+ reserved keyword:
578
1695
 
579
- Before:
1696
+ Example:
580
1697
 
581
- person.pets.count
582
- # SELECT COUNT(*) FROM "pets" WHERE "pets"."person_id" IS NULL
583
- # => 0
1698
+ SplitTest.group(:key).count
1699
+ Property.group(:value).count
584
1700
 
585
- After:
1701
+ *Bogdan Gusiev*
586
1702
 
587
- person.pets.count
588
- # fires without sql query
589
- # => 0
1703
+ * Added the `#or` method on `ActiveRecord::Relation`, allowing use of the OR
1704
+ operator to combine WHERE or HAVING clauses.
590
1705
 
591
- *Francesco Rodriguez*
1706
+ Example:
592
1707
 
593
- * Fix `reset_counters` crashing on `has_many :through` associations.
594
- Fix #7822.
1708
+ Post.where('id = 1').or(Post.where('id = 2'))
1709
+ # => SELECT * FROM posts WHERE (id = 1) OR (id = 2)
595
1710
 
596
- *lulalala*
1711
+ *Sean Griffin*, *Matthew Draper*, *Gael Muller*, *Olivier El Mekki*
597
1712
 
598
- * ConnectionPool recognizes checkout_timeout spec key as taking
599
- precedence over legacy wait_timeout spec key, can be used to avoid
600
- conflict with mysql2 use of wait_timeout. Closes #7684.
1713
+ * Don't define autosave association callbacks twice from
1714
+ `accepts_nested_attributes_for`.
601
1715
 
602
- *jrochkind*
1716
+ Fixes #18704.
603
1717
 
604
- * Rename field_changed? to _field_changed? so that users can create a field named field
1718
+ *Sean Griffin*
605
1719
 
606
- *Akira Matsuda*, backported by *Steve Klabnik*
1720
+ * Integer types will no longer raise a `RangeError` when assigning an
1721
+ attribute, but will instead raise when going to the database.
607
1722
 
608
- * Fix creation of through association models when using `collection=[]`
609
- on a `has_many :through` association from an unsaved model.
610
- Fix #7661.
1723
+ Fixes several vague issues which were never reported directly. See the
1724
+ commit message from the commit which added this line for some examples.
611
1725
 
612
- *Ernie Miller*
1726
+ *Sean Griffin*
613
1727
 
614
- * Explain only normal CRUD sql (select / update / insert / delete).
615
- Fix problem that explains unexplainable sql. Closes #7544 #6458.
1728
+ * Values which would error while being sent to the database (such as an
1729
+ ASCII-8BIT string with invalid UTF-8 bytes on SQLite3), no longer error on
1730
+ assignment. They will still error when sent to the database, but you are
1731
+ given the ability to re-assign it to a valid value.
616
1732
 
617
- *kennyj*
1733
+ Fixes #18580.
618
1734
 
619
- * Backport test coverage to ensure that PostgreSQL auto-reconnect functionality
620
- remains healthy.
1735
+ *Sean Griffin*
621
1736
 
622
- *Steve Jorgensen*
1737
+ * Don't remove join dependencies in `Relation#exists?`
623
1738
 
624
- * Use config['encoding'] instead of config['charset'] when executing
625
- databases.rake in the mysql/mysql2. A correct option for a database.yml
626
- is 'encoding'.
1739
+ Fixes #18632.
627
1740
 
628
- *kennyj*
1741
+ *Sean Griffin*
629
1742
 
630
- * Fix ConnectionAdapters::Column.type_cast_code integer conversion,
631
- to always convert values to integer calling #to_i. Fixes #7509.
1743
+ * Invalid values assigned to a JSON column are assumed to be `nil`.
632
1744
 
633
- *Thiago Pradi*
1745
+ Fixes #18629.
634
1746
 
635
- * Fix time column type casting for invalid time string values to correctly return nil.
1747
+ *Sean Griffin*
636
1748
 
637
- *Adam Meehan*
1749
+ * Add `ActiveRecord::Base#accessed_fields`, which can be used to quickly
1750
+ discover which fields were read from a model when you are looking to only
1751
+ select the data you need from the database.
638
1752
 
639
- * Fix `becomes` when using a configured `inheritance_column`.
1753
+ *Sean Griffin*
640
1754
 
641
- *Yves Senn*
1755
+ * Introduce the `:if_exists` option for `drop_table`.
642
1756
 
643
- * Fix `reset_counters` when there are multiple `belongs_to` association with the
644
- same foreign key and one of them have a counter cache.
645
- Fixes #5200.
1757
+ Example:
646
1758
 
647
- *Dave Desrochers*
1759
+ drop_table(:posts, if_exists: true)
648
1760
 
649
- * Round usec when comparing timestamp attributes in the dirty tracking.
650
- Fixes #6975.
1761
+ That would execute:
651
1762
 
652
- *kennyj*
1763
+ DROP TABLE IF EXISTS posts
653
1764
 
654
- * Use inversed parent for first and last child of has_many association.
1765
+ If the table doesn't exist, `if_exists: false` (the default) raises an
1766
+ exception whereas `if_exists: true` does nothing.
655
1767
 
656
- *Ravil Bayramgalin*
1768
+ *Cody Cutrer*, *Stefan Kanev*, *Ryuta Kamizono*
657
1769
 
658
- * Fix Column.microseconds and Column.fast_string_to_date to avoid converting
659
- timestamp seconds to a float, since it occasionally results in inaccuracies
660
- with microsecond-precision times. Fixes #7352.
1770
+ * Don't run SQL if attribute value is not changed for update_attribute method.
661
1771
 
662
- *Ari Pollak*
1772
+ *Prathamesh Sonpatki*
663
1773
 
664
- * Fix `increment!`, `decrement!`, `toggle!` that was skipping callbacks.
665
- Fixes #7306.
1774
+ * `time` columns can now get affected by `time_zone_aware_attributes`. If you have
1775
+ set `config.time_zone` to a value other than `'UTC'`, they will be treated
1776
+ as in that time zone by default in Rails 5.1. If this is not the desired
1777
+ behavior, you can set
666
1778
 
667
- *Rafael Mendonça França*
1779
+ ActiveRecord::Base.time_zone_aware_types = [:datetime]
1780
+
1781
+ A deprecation warning will be emitted if you have a `:time` column, and have
1782
+ not explicitly opted out.
1783
+
1784
+ Fixes #3145.
1785
+
1786
+ *Sean Griffin*
1787
+
1788
+ * Tests now run after_commit callbacks. You no longer have to declare
1789
+ `uses_transaction ‘test name’` to test the results of an after_commit.
1790
+
1791
+ after_commit callbacks run after committing a transaction whose parent
1792
+ is not `joinable?`: un-nested transactions, transactions within test cases,
1793
+ and transactions in `console --sandbox`.
1794
+
1795
+ *arthurnn*, *Ravil Bayramgalin*, *Matthew Draper*
668
1796
 
669
- * Fix AR#create to return an unsaved record when AR::RecordInvalid is
670
- raised. Fixes #3217.
1797
+ * `nil` as a value for a binary column in a query no longer logs as
1798
+ "<NULL binary data>", and instead logs as just "nil".
671
1799
 
672
- *Dave Yeu*
1800
+ *Sean Griffin*
673
1801
 
674
- * Remove unnecessary transaction when assigning has_one associations with a nil or equal value.
675
- Fix #7191.
1802
+ * `attribute_will_change!` will no longer cause non-persistable attributes to
1803
+ be sent to the database.
676
1804
 
677
- *kennyj*
1805
+ Fixes #18407.
678
1806
 
679
- * Allow store to work with an empty column.
680
- Fix #4840.
1807
+ *Sean Griffin*
681
1808
 
682
- *Jeremy Walker*
1809
+ * Remove support for the `protected_attributes` gem.
683
1810
 
684
- * Remove prepared statement from system query in postgresql adapter.
685
- Fix #5872.
1811
+ *Carlos Antonio da Silva*, *Roberto Miranda*
686
1812
 
687
- *Ivan Evtuhovich*
1813
+ * Fix accessing of fixtures having non-string labels like Fixnum.
688
1814
 
689
- * Make sure `:environment` task is executed before `db:schema:load` or `db:structure:load`
690
- Fixes #4772.
1815
+ *Prathamesh Sonpatki*
691
1816
 
692
- *Seamus Abshere*
1817
+ * Remove deprecated support to preload instance-dependent associations.
693
1818
 
1819
+ *Yves Senn*
1820
+
1821
+ * Remove deprecated support for PostgreSQL ranges with exclusive lower bounds.
1822
+
1823
+ *Yves Senn*
1824
+
1825
+ * Remove deprecation when modifying a relation with cached Arel.
1826
+ This raises an `ImmutableRelation` error instead.
1827
+
1828
+ *Yves Senn*
1829
+
1830
+ * Added `ActiveRecord::SecureToken` in order to encapsulate generation of
1831
+ unique tokens for attributes in a model using `SecureRandom`.
694
1832
 
695
- ## Rails 3.2.8 (Aug 9, 2012) ##
1833
+ *Roberto Miranda*
696
1834
 
697
- * Do not consider the numeric attribute as changed if the old value is zero and the new value
698
- is not a string.
699
- Fixes #7237.
1835
+ * Change the behavior of boolean columns to be closer to Ruby's semantics.
1836
+
1837
+ Before this change we had a small set of "truthy", and all others are "falsy".
1838
+
1839
+ Now, we have a small set of "falsy" values and all others are "truthy" matching
1840
+ Ruby's semantics.
1841
+
1842
+ *Rafael Mendonça França*
1843
+
1844
+ * Deprecate `ActiveRecord::Base.errors_in_transactional_callbacks=`.
700
1845
 
701
1846
  *Rafael Mendonça França*
702
1847
 
703
- * Removes the deprecation of `update_attribute`. *fxn*
1848
+ * Change transaction callbacks to not swallow errors.
1849
+
1850
+ Before this change any errors raised inside a transaction callback
1851
+ were getting rescued and printed in the logs.
1852
+
1853
+ Now these errors are not rescued anymore and just bubble up, as the other callbacks.
1854
+
1855
+ *Rafael Mendonça França*
704
1856
 
705
- * Reverted the deprecation of `composed_of`. *Rafael Mendonça França*
1857
+ * Remove deprecated `sanitize_sql_hash_for_conditions`.
706
1858
 
707
- * Reverted the deprecation of `*_sql` association options. They will
708
- be deprecated in 4.0 instead. *Jon Leighton*
1859
+ *Rafael Mendonça França*
709
1860
 
710
- * Do not eager load AR session store. ActiveRecord::SessionStore depends on the abstract store
711
- in Action Pack. Eager loading this class would break client code that eager loads Active Record
712
- standalone.
713
- Fixes #7160
1861
+ * Remove deprecated `Reflection#source_macro`.
714
1862
 
715
- *Xavier Noria*
1863
+ *Rafael Mendonça França*
716
1864
 
717
- * Do not set RAILS_ENV to "development" when using `db:test:prepare` and related rake tasks.
718
- This was causing the truncation of the development database data when using RSpec.
719
- Fixes #7175.
1865
+ * Remove deprecated `symbolized_base_class` and `symbolized_sti_name`.
720
1866
 
721
1867
  *Rafael Mendonça França*
722
1868
 
723
- ## Rails 3.2.7 (Jul 26, 2012) ##
1869
+ * Remove deprecated `ActiveRecord::Base.disable_implicit_join_references=`.
724
1870
 
725
- * `:finder_sql` and `:counter_sql` options on collection associations
726
- are deprecated. Please transition to using scopes.
1871
+ *Rafael Mendonça França*
727
1872
 
728
- *Jon Leighton*
1873
+ * Remove deprecated access to connection specification using a string accessor.
729
1874
 
730
- * `:insert_sql` and `:delete_sql` options on `has_and_belongs_to_many`
731
- associations are deprecated. Please transition to using `has_many
732
- :through`
1875
+ Now all strings will be handled as a URL.
733
1876
 
734
- *Jon Leighton*
1877
+ *Rafael Mendonça França*
735
1878
 
736
- * `composed_of` has been deprecated. You'll have to write your own accessor
737
- and mutator methods if you'd like to use value objects to represent some
738
- portion of your models.
1879
+ * Change the default `null` value for `timestamps` to `false`.
739
1880
 
740
- *Steve Klabnik*
1881
+ *Rafael Mendonça França*
741
1882
 
742
- * `update_attribute` has been deprecated. Use `update_column` if
743
- you want to bypass mass-assignment protection, validations, callbacks,
744
- and touching of updated_at. Otherwise please use `update_attributes`.
1883
+ * Return an array of pools from `connection_pools`.
745
1884
 
746
- *Steve Klabnik*
1885
+ *Rafael Mendonça França*
747
1886
 
748
- ## Rails 3.2.6 (Jun 12, 2012) ##
1887
+ * Return a null column from `column_for_attribute` when no column exists.
749
1888
 
750
- * protect against the nesting of hashes changing the
751
- table context in the next call to build_from_hash. This fix
752
- covers this case as well.
1889
+ *Rafael Mendonça França*
753
1890
 
754
- CVE-2012-2695
1891
+ * Remove deprecated `serialized_attributes`.
755
1892
 
756
- * Revert earlier 'perf fix' (see 3.2.4 changelog / GH #6289). This
757
- change introduced a regression (GH #6609). assoc.clear and
758
- assoc.delete_all have loaded the association before doing the delete
759
- since at least Rails 2.3. Doing the delete without loading the
760
- records means that the `before_remove` and `after_remove` callbacks do
761
- not get invoked. Therefore, this change was less a fix a more an
762
- optimisation, which should only have gone into master.
1893
+ *Rafael Mendonça França*
763
1894
 
764
- *Jon Leighton*
1895
+ * Remove deprecated automatic counter caches on `has_many :through`.
765
1896
 
766
- ## Rails 3.2.5 (Jun 1, 2012) ##
1897
+ *Rafael Mendonça França*
767
1898
 
768
- * Restore behavior of Active Record 3.2.3 scopes.
769
- A series of commits relating to preloading and scopes caused a regression.
1899
+ * Change the way in which callback chains can be halted.
770
1900
 
771
- *Andrew White*
1901
+ The preferred method to halt a callback chain from now on is to explicitly
1902
+ `throw(:abort)`.
1903
+ In the past, returning `false` in an Active Record `before_` callback had the
1904
+ side effect of halting the callback chain.
1905
+ This is not recommended anymore and, depending on the value of the
1906
+ `ActiveSupport.halt_callback_chains_on_return_false` option, will
1907
+ either not work at all or display a deprecation warning.
772
1908
 
1909
+ *claudiob*
773
1910
 
774
- ## Rails 3.2.4 (May 31, 2012) ##
1911
+ * Clear query cache on rollback.
775
1912
 
776
- * Perf fix: Don't load the records when doing assoc.delete_all.
777
- GH #6289. *Jon Leighton*
1913
+ *Florian Weingarten*
778
1914
 
779
- * Association preloading shouldn't be affected by the current scoping.
780
- This could cause infinite recursion and potentially other problems.
781
- See GH #5667. *Jon Leighton*
1915
+ * Fix setting of foreign_key for through associations when building a new record.
782
1916
 
783
- * Datetime attributes are forced to be changed. GH #3965
1917
+ Fixes #12698.
784
1918
 
785
- * Fix attribute casting. GH #5549
1919
+ *Ivan Antropov*
786
1920
 
787
- * Fix #5667. Preloading should ignore scoping.
1921
+ * Improve dumping of the primary key. If it is not a default primary key,
1922
+ correctly dump the type and options.
788
1923
 
789
- * Predicate builder should not recurse for determining where columns.
790
- Thanks to Ben Murphy for reporting this! CVE-2012-2661
1924
+ Fixes #14169, #16599.
791
1925
 
1926
+ *Ryuta Kamizono*
792
1927
 
793
- ## Rails 3.2.3 (March 30, 2012) ##
1928
+ * Format the datetime string according to the precision of the datetime field.
794
1929
 
795
- * Added find_or_create_by_{attribute}! dynamic method. *Andrew White*
1930
+ Incompatible to rounding behavior between MySQL 5.6 and earlier.
796
1931
 
797
- * Whitelist all attribute assignment by default. Change the default for newly generated applications to whitelist all attribute assignment. Also update the generated model classes so users are reminded of the importance of attr_accessible. *NZKoz*
1932
+ In 5.5, when you insert `2014-08-17 12:30:00.999999` the fractional part
1933
+ is ignored. In 5.6, it's rounded to `2014-08-17 12:30:01`:
798
1934
 
799
- * Update ActiveRecord::AttributeMethods#attribute_present? to return false for empty strings. *Jacobkg*
1935
+ http://bugs.mysql.com/bug.php?id=68760
800
1936
 
801
- * Fix associations when using per class databases. *larskanis*
1937
+ *Ryuta Kamizono*
802
1938
 
803
- * Revert setting NOT NULL constraints in add_timestamps *fxn*
1939
+ * Allow a precision option for MySQL datetimes.
804
1940
 
805
- * Fix mysql to use proper text types. Fixes #3931. *kennyj*
1941
+ *Ryuta Kamizono*
806
1942
 
807
- * Fix #5069 - Protect foreign key from mass assignment through association builder. *byroot*
1943
+ * Fixed automatic `inverse_of` for models nested in a module.
808
1944
 
1945
+ *Andrew McCloud*
809
1946
 
810
- ## Rails 3.2.2 (March 1, 2012) ##
1947
+ * Change `ActiveRecord::Relation#update` behavior so that it can
1948
+ be called without passing ids of the records to be updated.
811
1949
 
812
- * No changes.
1950
+ This change allows updating multiple records returned by
1951
+ `ActiveRecord::Relation` with callbacks and validations.
813
1952
 
1953
+ # Before
1954
+ # ArgumentError: wrong number of arguments (1 for 2)
1955
+ Comment.where(group: 'expert').update(body: "Group of Rails Experts")
814
1956
 
815
- ## Rails 3.2.1 (January 26, 2012) ##
1957
+ # After
1958
+ # Comments with group expert updated with body "Group of Rails Experts"
1959
+ Comment.where(group: 'expert').update(body: "Group of Rails Experts")
816
1960
 
817
- * The threshold for auto EXPLAIN is ignored if there's no logger. *fxn*
1961
+ *Prathamesh Sonpatki*
818
1962
 
819
- * Call `to_s` on the value passed to `table_name=`, in particular symbols
820
- are supported (regression). *Sergey Nartimov*
1963
+ * Fix `reaping_frequency` option when the value is a string.
821
1964
 
822
- * Fix possible race condition when two threads try to define attribute
823
- methods for the same class. *Jon Leighton*
1965
+ This usually happens when it is configured using `DATABASE_URL`.
824
1966
 
1967
+ *korbin*
825
1968
 
826
- ## Rails 3.2.0 (January 20, 2012) ##
1969
+ * Fix error message when trying to create an associated record and the foreign
1970
+ key is missing.
827
1971
 
828
- * Added a `with_lock` method to ActiveRecord objects, which starts
829
- a transaction, locks the object (pessimistically) and yields to the block.
830
- The method takes one (optional) parameter and passes it to `lock!`.
1972
+ Before this fix the following exception was being raised:
831
1973
 
832
- Before:
1974
+ NoMethodError: undefined method `val' for #<Arel::Nodes::BindParam:0x007fc64d19c218>
833
1975
 
834
- class Order < ActiveRecord::Base
835
- def cancel!
836
- transaction do
837
- lock!
838
- # ... cancelling logic
839
- end
840
- end
841
- end
1976
+ Now the message is:
842
1977
 
843
- After:
1978
+ ActiveRecord::UnknownAttributeError: unknown attribute 'foreign_key' for Model.
844
1979
 
845
- class Order < ActiveRecord::Base
846
- def cancel!
847
- with_lock do
848
- # ... cancelling logic
849
- end
850
- end
851
- end
1980
+ *Rafael Mendonça França*
852
1981
 
853
- *Olek Janiszewski*
1982
+ * Fix change detection problem for PostgreSQL bytea type and
1983
+ `ArgumentError: string contains null byte` exception with pg-0.18.
854
1984
 
855
- * 'on' and 'ON' boolean columns values are type casted to true
856
- *Santiago Pastorino*
1985
+ Fixes #17680.
857
1986
 
858
- * Added ability to run migrations only for given scope, which allows
859
- to run migrations only from one engine (for example to revert changes
860
- from engine that you want to remove).
1987
+ *Lars Kanis*
861
1988
 
862
- Example:
863
- rake db:migrate SCOPE=blog
1989
+ * When a table has a composite primary key, the `primary_key` method for
1990
+ SQLite3 and PostgreSQL adapters was only returning the first field of the key.
1991
+ Ensures that it will return nil instead, as Active Record doesn't support
1992
+ composite primary keys.
864
1993
 
865
- *Piotr Sarnacki*
1994
+ Fixes #18070.
866
1995
 
867
- * Migrations copied from engines are now scoped with engine's name,
868
- for example 01_create_posts.blog.rb. *Piotr Sarnacki*
1996
+ *arthurnn*
869
1997
 
870
- * Implements `AR::Base.silence_auto_explain`. This method allows the user to
871
- selectively disable automatic EXPLAINs within a block. *fxn*
1998
+ * `validates_size_of` / `validates_length_of` do not count records
1999
+ which are `marked_for_destruction?`.
872
2000
 
873
- * Implements automatic EXPLAIN logging for slow queries.
2001
+ Fixes #7247.
874
2002
 
875
- A new configuration parameter `config.active_record.auto_explain_threshold_in_seconds`
876
- determines what's to be considered a slow query. Setting that to `nil` disables
877
- this feature. Defaults are 0.5 in development mode, and `nil` in test and production
878
- modes.
2003
+ *Yves Senn*
879
2004
 
880
- As of this writing there's support for SQLite, MySQL (mysql2 adapter), and
881
- PostgreSQL.
2005
+ * Ensure `first!` and friends work on loaded associations.
882
2006
 
883
- *fxn*
2007
+ Fixes #18237.
884
2008
 
885
- * Implemented ActiveRecord::Relation#pluck method
2009
+ *Sean Griffin*
886
2010
 
887
- Method returns Array of column value from table under ActiveRecord model
2011
+ * `eager_load` preserves readonly flag for associations.
888
2012
 
889
- Client.pluck(:id)
2013
+ Fixes #15853.
890
2014
 
891
- *Bogdan Gusiev*
2015
+ *Takashi Kokubun*
892
2016
 
893
- * Automatic closure of connections in threads is deprecated. For example
894
- the following code is deprecated:
2017
+ * Provide `:touch` option to `save()` to accommodate saving without updating
2018
+ timestamps.
895
2019
 
896
- Thread.new { Post.find(1) }.join
2020
+ Fixes #18202.
897
2021
 
898
- It should be changed to close the database connection at the end of
899
- the thread:
2022
+ *Dan Olson*
900
2023
 
901
- Thread.new {
902
- Post.find(1)
903
- Post.connection.close
904
- }.join
2024
+ * Provide a more helpful error message when an unsupported class is passed to
2025
+ `serialize`.
905
2026
 
906
- Only people who spawn threads in their application code need to worry
907
- about this change.
2027
+ Fixes #18224.
908
2028
 
909
- * Deprecated:
2029
+ *Sean Griffin*
910
2030
 
911
- * `set_table_name`
912
- * `set_inheritance_column`
913
- * `set_sequence_name`
914
- * `set_primary_key`
915
- * `set_locking_column`
2031
+ * Add bigint primary key support for MySQL.
916
2032
 
917
- Use an assignment method instead. For example, instead of `set_table_name`, use `self.table_name=`:
2033
+ Example:
918
2034
 
919
- class Project < ActiveRecord::Base
920
- self.table_name = "project"
921
- end
2035
+ create_table :foos, id: :bigint do |t|
2036
+ end
922
2037
 
923
- Or define your own `self.table_name` method:
2038
+ *Ryuta Kamizono*
924
2039
 
925
- class Post < ActiveRecord::Base
926
- def self.table_name
927
- "special_" + super
928
- end
929
- end
930
- Post.table_name # => "special_posts"
2040
+ * Support for any type of primary key.
931
2041
 
932
- *Jon Leighton*
2042
+ Fixes #14194.
933
2043
 
934
- * Generated association methods are created within a separate module to allow overriding and
935
- composition using `super`. For a class named `MyModel`, the module is named
936
- `MyModel::GeneratedFeatureMethods`. It is included into the model class immediately after
937
- the `generated_attributes_methods` module defined in ActiveModel, so association methods
938
- override attribute methods of the same name. *Josh Susser*
2044
+ *Ryuta Kamizono*
939
2045
 
940
- * Implemented ActiveRecord::Relation#explain. *fxn*
2046
+ * Dump the default `nil` for PostgreSQL UUID primary key.
941
2047
 
942
- * Add ActiveRecord::Relation#uniq for generating unique queries.
2048
+ *Ryuta Kamizono*
943
2049
 
944
- Before:
2050
+ * Add a `:foreign_key` option to `references` and associated migration
2051
+ methods. The model and migration generators now use this option, rather than
2052
+ the `add_foreign_key` form.
945
2053
 
946
- Client.select('DISTINCT name')
2054
+ *Sean Griffin*
947
2055
 
948
- After:
2056
+ * Don't raise when writing an attribute with an out-of-range datetime passed
2057
+ by the user.
949
2058
 
950
- Client.select(:name).uniq
2059
+ *Grey Baker*
951
2060
 
952
- This also allows you to revert the unqueness in a relation:
2061
+ * Replace deprecated `ActiveRecord::Tasks::DatabaseTasks#load_schema` with
2062
+ `ActiveRecord::Tasks::DatabaseTasks#load_schema_for`.
953
2063
 
954
- Client.select(:name).uniq.uniq(false)
2064
+ *Yves Senn*
955
2065
 
956
- *Jon Leighton*
2066
+ * Fix bug with `ActiveRecord::Type::Numeric` that caused negative values to
2067
+ be marked as having changed when set to the same negative value.
957
2068
 
958
- * Support index sort order in sqlite, mysql and postgres adapters. *Vlad Jebelev*
2069
+ Fixes #18161.
959
2070
 
960
- * Allow the :class_name option for associations to take a symbol (:Client) in addition to
961
- a string ('Client').
2071
+ *Daniel Fox*
962
2072
 
963
- This is to avoid confusing newbies, and to be consistent with the fact that other options
964
- like :foreign_key already allow a symbol or a string.
2073
+ * Introduce `force: :cascade` option for `create_table`. Using this option
2074
+ will recreate tables even if they have dependent objects (like foreign keys).
2075
+ `db/schema.rb` now uses `force: :cascade`. This makes it possible to
2076
+ reload the schema when foreign keys are in place.
965
2077
 
966
- *Jon Leighton*
2078
+ *Matthew Draper*, *Yves Senn*
967
2079
 
968
- * In development mode the db:drop task also drops the test database. For symmetry with
969
- the db:create task. *Dmitriy Kiriyenko*
2080
+ * `db:schema:load` and `db:structure:load` no longer purge the database
2081
+ before loading the schema. This is left for the user to do.
2082
+ `db:test:prepare` will still purge the database.
970
2083
 
971
- * Added ActiveRecord::Base.store for declaring simple single-column key/value stores *DHH*
2084
+ Fixes #17945.
972
2085
 
973
- class User < ActiveRecord::Base
974
- store :settings, accessors: [ :color, :homepage ]
975
- end
2086
+ *Yves Senn*
976
2087
 
977
- u = User.new(color: 'black', homepage: '37signals.com')
978
- u.color # Accessor stored attribute
979
- u.settings[:country] = 'Denmark' # Any attribute, even if not specified with an accessor
2088
+ * Fix undesirable RangeError by `Type::Integer`. Add `Type::UnsignedInteger`.
980
2089
 
2090
+ *Ryuta Kamizono*
981
2091
 
982
- * MySQL: case-insensitive uniqueness validation avoids calling LOWER when
983
- the column already uses a case-insensitive collation. Fixes #561.
2092
+ * Add `foreign_type` option to `has_one` and `has_many` association macros.
984
2093
 
985
- *Joseph Palermo*
2094
+ This option enables to define the column name of associated object's type for polymorphic associations.
986
2095
 
987
- * Transactional fixtures enlist all active database connections. You can test
988
- models on different connections without disabling transactional fixtures.
2096
+ *Ulisses Almeida*, *Kassio Borges*
989
2097
 
990
- *Jeremy Kemper*
2098
+ * Remove deprecated behavior allowing nested arrays to be passed as query
2099
+ values.
991
2100
 
992
- * Add first_or_create, first_or_create!, first_or_initialize methods to Active Record. This is a
993
- better approach over the old find_or_create_by dynamic methods because it's clearer which
994
- arguments are used to find the record and which are used to create it:
2101
+ *Melanie Gilman*
995
2102
 
996
- User.where(:first_name => "Scarlett").first_or_create!(:last_name => "Johansson")
2103
+ * Deprecate passing a class as a value in a query. Users should pass strings
2104
+ instead.
997
2105
 
998
- *Andrés Mejía*
2106
+ *Melanie Gilman*
999
2107
 
1000
- * Fix nested attributes bug where _destroy parameter is taken into account
1001
- during :reject_if => :all_blank (fixes #2937)
2108
+ * `add_timestamps` and `remove_timestamps` now properly reversible with
2109
+ options.
1002
2110
 
1003
- *Aaron Christy*
2111
+ *Noam Gagliardi-Rabinovich*
1004
2112
 
1005
- * Add ActiveSupport::Cache::NullStore for use in development and testing.
2113
+ * `ActiveRecord::ConnectionAdapters::ColumnDumper#column_spec` and
2114
+ `ActiveRecord::ConnectionAdapters::ColumnDumper#prepare_column_options` no
2115
+ longer have a `types` argument. They should access
2116
+ `connection#native_database_types` directly.
1006
2117
 
1007
- *Brian Durand*
2118
+ *Yves Senn*
1008
2119
 
1009
- Please check [3-1-stable](https://github.com/rails/rails/blob/3-1-stable/activerecord/CHANGELOG.md) for previous changes.
2120
+ Please check [4-2-stable](https://github.com/rails/rails/blob/4-2-stable/activerecord/CHANGELOG.md) for previous changes.