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