activerecord 4.2.11 → 5.2.4.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activerecord might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +580 -1626
- data/MIT-LICENSE +2 -2
- data/README.rdoc +10 -11
- data/examples/performance.rb +32 -31
- data/examples/simple.rb +5 -4
- data/lib/active_record/aggregations.rb +263 -249
- data/lib/active_record/association_relation.rb +11 -6
- data/lib/active_record/associations/alias_tracker.rb +29 -35
- data/lib/active_record/associations/association.rb +77 -43
- data/lib/active_record/associations/association_scope.rb +106 -133
- data/lib/active_record/associations/belongs_to_association.rb +52 -41
- data/lib/active_record/associations/belongs_to_polymorphic_association.rb +8 -8
- data/lib/active_record/associations/builder/association.rb +29 -38
- data/lib/active_record/associations/builder/belongs_to.rb +77 -30
- data/lib/active_record/associations/builder/collection_association.rb +9 -22
- data/lib/active_record/associations/builder/has_and_belongs_to_many.rb +42 -35
- data/lib/active_record/associations/builder/has_many.rb +6 -4
- data/lib/active_record/associations/builder/has_one.rb +13 -6
- data/lib/active_record/associations/builder/singular_association.rb +15 -11
- data/lib/active_record/associations/collection_association.rb +139 -280
- data/lib/active_record/associations/collection_proxy.rb +231 -133
- data/lib/active_record/associations/foreign_association.rb +3 -1
- data/lib/active_record/associations/has_many_association.rb +34 -89
- data/lib/active_record/associations/has_many_through_association.rb +49 -76
- data/lib/active_record/associations/has_one_association.rb +38 -24
- data/lib/active_record/associations/has_one_through_association.rb +18 -9
- data/lib/active_record/associations/join_dependency/join_association.rb +40 -87
- data/lib/active_record/associations/join_dependency/join_base.rb +10 -9
- data/lib/active_record/associations/join_dependency/join_part.rb +12 -12
- data/lib/active_record/associations/join_dependency.rb +133 -159
- data/lib/active_record/associations/preloader/association.rb +85 -120
- data/lib/active_record/associations/preloader/through_association.rb +85 -74
- data/lib/active_record/associations/preloader.rb +81 -91
- data/lib/active_record/associations/singular_association.rb +27 -34
- data/lib/active_record/associations/through_association.rb +38 -18
- data/lib/active_record/associations.rb +1732 -1597
- data/lib/active_record/attribute_assignment.rb +58 -182
- data/lib/active_record/attribute_decorators.rb +39 -15
- data/lib/active_record/attribute_methods/before_type_cast.rb +10 -8
- data/lib/active_record/attribute_methods/dirty.rb +94 -135
- data/lib/active_record/attribute_methods/primary_key.rb +86 -71
- data/lib/active_record/attribute_methods/query.rb +4 -2
- data/lib/active_record/attribute_methods/read.rb +45 -63
- data/lib/active_record/attribute_methods/serialization.rb +40 -20
- data/lib/active_record/attribute_methods/time_zone_conversion.rb +58 -36
- data/lib/active_record/attribute_methods/write.rb +30 -45
- data/lib/active_record/attribute_methods.rb +166 -109
- data/lib/active_record/attributes.rb +201 -82
- data/lib/active_record/autosave_association.rb +94 -36
- data/lib/active_record/base.rb +57 -44
- data/lib/active_record/callbacks.rb +97 -57
- data/lib/active_record/coders/json.rb +3 -1
- data/lib/active_record/coders/yaml_column.rb +24 -12
- data/lib/active_record/collection_cache_key.rb +53 -0
- data/lib/active_record/connection_adapters/abstract/connection_pool.rb +712 -290
- data/lib/active_record/connection_adapters/abstract/database_limits.rb +10 -5
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +237 -90
- data/lib/active_record/connection_adapters/abstract/query_cache.rb +71 -21
- data/lib/active_record/connection_adapters/abstract/quoting.rb +118 -52
- data/lib/active_record/connection_adapters/abstract/savepoints.rb +5 -3
- data/lib/active_record/connection_adapters/abstract/schema_creation.rb +67 -46
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +318 -217
- data/lib/active_record/connection_adapters/abstract/schema_dumper.rb +81 -36
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +570 -228
- data/lib/active_record/connection_adapters/abstract/transaction.rb +138 -70
- data/lib/active_record/connection_adapters/abstract_adapter.rb +325 -202
- data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +542 -601
- data/lib/active_record/connection_adapters/column.rb +50 -41
- data/lib/active_record/connection_adapters/connection_specification.rb +147 -135
- data/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb +33 -0
- data/lib/active_record/connection_adapters/mysql/column.rb +27 -0
- data/lib/active_record/connection_adapters/mysql/database_statements.rb +140 -0
- data/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb +72 -0
- data/lib/active_record/connection_adapters/mysql/quoting.rb +44 -0
- data/lib/active_record/connection_adapters/mysql/schema_creation.rb +73 -0
- data/lib/active_record/connection_adapters/mysql/schema_definitions.rb +87 -0
- data/lib/active_record/connection_adapters/mysql/schema_dumper.rb +80 -0
- data/lib/active_record/connection_adapters/mysql/schema_statements.rb +148 -0
- data/lib/active_record/connection_adapters/mysql/type_metadata.rb +35 -0
- data/lib/active_record/connection_adapters/mysql2_adapter.rb +41 -180
- data/lib/active_record/connection_adapters/postgresql/column.rb +35 -11
- data/lib/active_record/connection_adapters/postgresql/database_statements.rb +45 -114
- data/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb +44 -0
- data/lib/active_record/connection_adapters/postgresql/oid/array.rb +50 -58
- data/lib/active_record/connection_adapters/postgresql/oid/bit.rb +10 -6
- data/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb +2 -0
- data/lib/active_record/connection_adapters/postgresql/oid/bytea.rb +4 -2
- data/lib/active_record/connection_adapters/postgresql/oid/cidr.rb +5 -1
- data/lib/active_record/connection_adapters/postgresql/oid/date.rb +13 -1
- data/lib/active_record/connection_adapters/postgresql/oid/date_time.rb +9 -22
- data/lib/active_record/connection_adapters/postgresql/oid/decimal.rb +3 -1
- data/lib/active_record/connection_adapters/postgresql/oid/enum.rb +5 -3
- data/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +31 -19
- data/lib/active_record/connection_adapters/postgresql/oid/inet.rb +2 -0
- data/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb +3 -11
- data/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb +45 -0
- data/lib/active_record/connection_adapters/postgresql/oid/money.rb +5 -7
- data/lib/active_record/connection_adapters/postgresql/oid/{integer.rb → oid.rb} +6 -2
- data/lib/active_record/connection_adapters/postgresql/oid/point.rb +33 -11
- data/lib/active_record/connection_adapters/postgresql/oid/range.rb +52 -34
- data/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb +4 -5
- data/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb +55 -53
- data/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +5 -3
- data/lib/active_record/connection_adapters/postgresql/oid/vector.rb +3 -1
- data/lib/active_record/connection_adapters/postgresql/oid/xml.rb +3 -1
- data/lib/active_record/connection_adapters/postgresql/oid.rb +23 -25
- data/lib/active_record/connection_adapters/postgresql/quoting.rb +107 -47
- data/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +27 -14
- data/lib/active_record/connection_adapters/postgresql/schema_creation.rb +65 -0
- data/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +144 -90
- data/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +50 -0
- data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +462 -284
- data/lib/active_record/connection_adapters/postgresql/type_metadata.rb +39 -0
- data/lib/active_record/connection_adapters/postgresql/utils.rb +12 -8
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +432 -323
- data/lib/active_record/connection_adapters/schema_cache.rb +48 -24
- data/lib/active_record/connection_adapters/sql_type_metadata.rb +34 -0
- data/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb +21 -0
- data/lib/active_record/connection_adapters/sqlite3/quoting.rb +67 -0
- data/lib/active_record/connection_adapters/sqlite3/schema_creation.rb +17 -0
- data/lib/active_record/connection_adapters/sqlite3/schema_definitions.rb +19 -0
- data/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb +18 -0
- data/lib/active_record/connection_adapters/sqlite3/schema_statements.rb +106 -0
- data/lib/active_record/connection_adapters/sqlite3_adapter.rb +269 -308
- data/lib/active_record/connection_adapters/statement_pool.rb +34 -13
- data/lib/active_record/connection_handling.rb +40 -27
- data/lib/active_record/core.rb +178 -198
- data/lib/active_record/counter_cache.rb +79 -36
- data/lib/active_record/define_callbacks.rb +22 -0
- data/lib/active_record/dynamic_matchers.rb +87 -105
- data/lib/active_record/enum.rb +135 -88
- data/lib/active_record/errors.rb +179 -52
- data/lib/active_record/explain.rb +23 -11
- data/lib/active_record/explain_registry.rb +4 -2
- data/lib/active_record/explain_subscriber.rb +10 -5
- data/lib/active_record/fixture_set/file.rb +35 -9
- data/lib/active_record/fixtures.rb +188 -132
- data/lib/active_record/gem_version.rb +5 -3
- data/lib/active_record/inheritance.rb +148 -112
- data/lib/active_record/integration.rb +70 -28
- data/lib/active_record/internal_metadata.rb +45 -0
- data/lib/active_record/legacy_yaml_adapter.rb +21 -3
- data/lib/active_record/locale/en.yml +3 -2
- data/lib/active_record/locking/optimistic.rb +88 -96
- data/lib/active_record/locking/pessimistic.rb +15 -3
- data/lib/active_record/log_subscriber.rb +95 -33
- data/lib/active_record/migration/command_recorder.rb +133 -90
- data/lib/active_record/migration/compatibility.rb +217 -0
- data/lib/active_record/migration/join_table.rb +8 -6
- data/lib/active_record/migration.rb +581 -282
- data/lib/active_record/model_schema.rb +290 -111
- data/lib/active_record/nested_attributes.rb +264 -222
- data/lib/active_record/no_touching.rb +7 -1
- data/lib/active_record/null_relation.rb +24 -37
- data/lib/active_record/persistence.rb +347 -119
- data/lib/active_record/query_cache.rb +13 -24
- data/lib/active_record/querying.rb +19 -17
- data/lib/active_record/railtie.rb +94 -32
- data/lib/active_record/railties/console_sandbox.rb +2 -0
- data/lib/active_record/railties/controller_runtime.rb +9 -3
- data/lib/active_record/railties/databases.rake +149 -156
- data/lib/active_record/readonly_attributes.rb +5 -4
- data/lib/active_record/reflection.rb +414 -267
- data/lib/active_record/relation/batches/batch_enumerator.rb +69 -0
- data/lib/active_record/relation/batches.rb +204 -55
- data/lib/active_record/relation/calculations.rb +256 -248
- data/lib/active_record/relation/delegation.rb +67 -60
- data/lib/active_record/relation/finder_methods.rb +288 -239
- data/lib/active_record/relation/from_clause.rb +26 -0
- data/lib/active_record/relation/merger.rb +86 -86
- data/lib/active_record/relation/predicate_builder/array_handler.rb +24 -24
- data/lib/active_record/relation/predicate_builder/association_query_value.rb +46 -0
- data/lib/active_record/relation/predicate_builder/base_handler.rb +19 -0
- data/lib/active_record/relation/predicate_builder/basic_object_handler.rb +20 -0
- data/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb +56 -0
- data/lib/active_record/relation/predicate_builder/range_handler.rb +42 -0
- data/lib/active_record/relation/predicate_builder/relation_handler.rb +7 -1
- data/lib/active_record/relation/predicate_builder.rb +116 -119
- data/lib/active_record/relation/query_attribute.rb +45 -0
- data/lib/active_record/relation/query_methods.rb +448 -393
- data/lib/active_record/relation/record_fetch_warning.rb +51 -0
- data/lib/active_record/relation/spawn_methods.rb +11 -13
- data/lib/active_record/relation/where_clause.rb +186 -0
- data/lib/active_record/relation/where_clause_factory.rb +34 -0
- data/lib/active_record/relation.rb +287 -340
- data/lib/active_record/result.rb +54 -36
- data/lib/active_record/runtime_registry.rb +6 -4
- data/lib/active_record/sanitization.rb +155 -124
- data/lib/active_record/schema.rb +30 -24
- data/lib/active_record/schema_dumper.rb +91 -87
- data/lib/active_record/schema_migration.rb +19 -16
- data/lib/active_record/scoping/default.rb +102 -85
- data/lib/active_record/scoping/named.rb +81 -32
- data/lib/active_record/scoping.rb +45 -26
- data/lib/active_record/secure_token.rb +40 -0
- data/lib/active_record/serialization.rb +5 -5
- data/lib/active_record/statement_cache.rb +45 -35
- data/lib/active_record/store.rb +42 -36
- data/lib/active_record/suppressor.rb +61 -0
- data/lib/active_record/table_metadata.rb +82 -0
- data/lib/active_record/tasks/database_tasks.rb +134 -96
- data/lib/active_record/tasks/mysql_database_tasks.rb +56 -100
- data/lib/active_record/tasks/postgresql_database_tasks.rb +83 -41
- data/lib/active_record/tasks/sqlite_database_tasks.rb +44 -16
- data/lib/active_record/timestamp.rb +70 -38
- data/lib/active_record/touch_later.rb +64 -0
- data/lib/active_record/transactions.rb +199 -124
- data/lib/active_record/translation.rb +2 -0
- data/lib/active_record/type/adapter_specific_registry.rb +136 -0
- data/lib/active_record/type/date.rb +4 -45
- data/lib/active_record/type/date_time.rb +4 -49
- data/lib/active_record/type/decimal_without_scale.rb +6 -2
- data/lib/active_record/type/hash_lookup_type_map.rb +5 -3
- data/lib/active_record/type/internal/timezone.rb +17 -0
- data/lib/active_record/type/json.rb +30 -0
- data/lib/active_record/type/serialized.rb +24 -15
- data/lib/active_record/type/text.rb +2 -2
- data/lib/active_record/type/time.rb +11 -16
- data/lib/active_record/type/type_map.rb +15 -17
- data/lib/active_record/type/unsigned_integer.rb +9 -7
- data/lib/active_record/type.rb +79 -23
- data/lib/active_record/type_caster/connection.rb +33 -0
- data/lib/active_record/type_caster/map.rb +23 -0
- data/lib/active_record/type_caster.rb +9 -0
- data/lib/active_record/validations/absence.rb +25 -0
- data/lib/active_record/validations/associated.rb +13 -4
- data/lib/active_record/validations/length.rb +26 -0
- data/lib/active_record/validations/presence.rb +14 -13
- data/lib/active_record/validations/uniqueness.rb +40 -41
- data/lib/active_record/validations.rb +38 -35
- data/lib/active_record/version.rb +3 -1
- data/lib/active_record.rb +34 -22
- data/lib/rails/generators/active_record/application_record/application_record_generator.rb +27 -0
- data/lib/rails/generators/active_record/application_record/templates/application_record.rb.tt +5 -0
- data/lib/rails/generators/active_record/migration/migration_generator.rb +43 -35
- data/lib/rails/generators/active_record/migration/templates/{create_table_migration.rb → create_table_migration.rb.tt} +8 -3
- data/lib/rails/generators/active_record/migration/templates/{migration.rb → migration.rb.tt} +8 -1
- data/lib/rails/generators/active_record/migration.rb +18 -1
- data/lib/rails/generators/active_record/model/model_generator.rb +18 -22
- data/lib/rails/generators/active_record/model/templates/{model.rb → model.rb.tt} +3 -0
- data/lib/rails/generators/active_record/model/templates/{module.rb → module.rb.tt} +0 -0
- data/lib/rails/generators/active_record.rb +7 -5
- metadata +72 -50
- data/lib/active_record/associations/preloader/belongs_to.rb +0 -17
- data/lib/active_record/associations/preloader/collection_association.rb +0 -24
- data/lib/active_record/associations/preloader/has_many.rb +0 -17
- data/lib/active_record/associations/preloader/has_many_through.rb +0 -19
- data/lib/active_record/associations/preloader/has_one.rb +0 -23
- data/lib/active_record/associations/preloader/has_one_through.rb +0 -9
- data/lib/active_record/associations/preloader/singular_association.rb +0 -21
- data/lib/active_record/attribute.rb +0 -163
- data/lib/active_record/attribute_set/builder.rb +0 -106
- data/lib/active_record/attribute_set.rb +0 -81
- data/lib/active_record/connection_adapters/mysql_adapter.rb +0 -498
- data/lib/active_record/connection_adapters/postgresql/array_parser.rb +0 -93
- data/lib/active_record/connection_adapters/postgresql/oid/float.rb +0 -21
- data/lib/active_record/connection_adapters/postgresql/oid/infinity.rb +0 -13
- data/lib/active_record/connection_adapters/postgresql/oid/json.rb +0 -35
- data/lib/active_record/connection_adapters/postgresql/oid/time.rb +0 -11
- data/lib/active_record/railties/jdbcmysql_error.rb +0 -16
- data/lib/active_record/serializers/xml_serializer.rb +0 -193
- data/lib/active_record/type/big_integer.rb +0 -13
- data/lib/active_record/type/binary.rb +0 -50
- data/lib/active_record/type/boolean.rb +0 -31
- data/lib/active_record/type/decimal.rb +0 -64
- data/lib/active_record/type/decorator.rb +0 -14
- data/lib/active_record/type/float.rb +0 -19
- data/lib/active_record/type/integer.rb +0 -59
- data/lib/active_record/type/mutable.rb +0 -16
- data/lib/active_record/type/numeric.rb +0 -36
- data/lib/active_record/type/string.rb +0 -40
- data/lib/active_record/type/time_value.rb +0 -38
- data/lib/active_record/type/value.rb +0 -110
data/CHANGELOG.md
CHANGED
@@ -1,2028 +1,982 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 5.2.4.1 (December 18, 2019) ##
|
2
2
|
|
3
3
|
* No changes.
|
4
4
|
|
5
5
|
|
6
|
-
## Rails
|
6
|
+
## Rails 5.2.4 (November 27, 2019) ##
|
7
7
|
|
8
|
-
* `
|
9
|
-
`current_scope`, with the exception of `unscoped`.
|
10
|
-
|
11
|
-
Fixes #29338.
|
12
|
-
|
13
|
-
*Sean Griffin*
|
14
|
-
|
15
|
-
## Rails 4.2.9 (June 26, 2017) ##
|
16
|
-
|
17
|
-
* Fix regression caused by `collection_singular_ids=` ignoring different primary key on relationship.
|
8
|
+
* Fix circular `autosave: true` causes invalid records to be saved.
|
18
9
|
|
19
|
-
|
10
|
+
Prior to the fix, when there was a circular series of `autosave: true`
|
11
|
+
associations, the callback for a `has_many` association was run while
|
12
|
+
another instance of the same callback on the same association hadn't
|
13
|
+
finished running. When control returned to the first instance of the
|
14
|
+
callback, the instance variable had changed, and subsequent associated
|
15
|
+
records weren't saved correctly. Specifically, the ID field for the
|
16
|
+
`belongs_to` corresponding to the `has_many` was `nil`.
|
20
17
|
|
21
|
-
|
18
|
+
Fixes #28080.
|
22
19
|
|
23
|
-
*
|
24
|
-
|
25
|
-
* Fix `rake db:migrate:status` with subdirectories.
|
26
|
-
|
27
|
-
*Ryuta Kamizono*
|
20
|
+
*Larry Reid*
|
28
21
|
|
29
|
-
* Fix
|
22
|
+
* PostgreSQL: Fix GROUP BY with ORDER BY virtual count attribute.
|
30
23
|
|
31
|
-
|
32
|
-
|
33
|
-
* Fix `wait_timeout` to configurable for mysql2 adapter.
|
34
|
-
|
35
|
-
Fixes #26556.
|
24
|
+
Fixes #36022.
|
36
25
|
|
37
26
|
*Ryuta Kamizono*
|
38
27
|
|
39
|
-
*
|
40
|
-
so queries are not run against the previous table name.
|
41
|
-
|
42
|
-
*namusyaka*
|
43
|
-
|
44
|
-
|
45
|
-
## Rails 4.2.8 (February 21, 2017) ##
|
46
|
-
|
47
|
-
* Using a mysql2 connection after it fails to reconnect will now have an error message
|
48
|
-
saying the connection is closed rather than an undefined method error message.
|
49
|
-
|
50
|
-
*Dylan Thacker-Smith*
|
51
|
-
|
52
|
-
* Bust Model.attribute_names cache when resetting column information
|
53
|
-
|
54
|
-
*James Coleman*
|
55
|
-
|
56
|
-
* Fix query caching when type information is reset
|
57
|
-
|
58
|
-
Backports ancillary fix in 5.0.
|
59
|
-
|
60
|
-
*James Coleman*
|
61
|
-
|
62
|
-
* Allow `joins` to be unscoped.
|
63
|
-
|
64
|
-
Fixes #13775.
|
65
|
-
|
66
|
-
*Takashi Kokubun*
|
67
|
-
|
68
|
-
* Hashes can once again be passed to setters of `composed_of`, if all of the
|
69
|
-
mapping methods are methods implemented on `Hash`.
|
70
|
-
|
71
|
-
Fixes #25978.
|
72
|
-
|
73
|
-
*Sean Griffin*
|
74
|
-
|
75
|
-
|
76
|
-
## Rails 4.2.7 (July 12, 2016) ##
|
77
|
-
|
78
|
-
* Inspecting an object with an associated array of over 10 elements no longer
|
79
|
-
truncates the array, preventing `inspect` from looping infinitely in some
|
80
|
-
cases.
|
81
|
-
|
82
|
-
*Kevin McPhillips*
|
83
|
-
|
84
|
-
* Ensure hashes can be assigned to attributes created using `composed_of`.
|
85
|
-
Fixes #25210.
|
28
|
+
* Fix sqlite3 collation parsing when using decimal columns.
|
86
29
|
|
87
|
-
*
|
30
|
+
*Martin R. Schuster*
|
88
31
|
|
89
|
-
*
|
90
|
-
interpreted as `Computer.joins(:monitor).group('computers.status').count`
|
91
|
-
so that when `Computer` and `Monitor` have both `status` columns we don't
|
92
|
-
have conflicts in projection.
|
32
|
+
* Make ActiveRecord `ConnectionPool.connections` method thread-safe.
|
93
33
|
|
94
|
-
|
34
|
+
Fixes #36465.
|
95
35
|
|
96
|
-
*
|
97
|
-
are specified or an ActiveRecord::StatementInvalid when an invalid type
|
98
|
-
is provided for a column name (e.g. a Hash).
|
36
|
+
*Jeff Doering*
|
99
37
|
|
100
|
-
|
38
|
+
* Assign all attributes before calling `build` to ensure the child record is visible in
|
39
|
+
`before_add` and `after_add` callbacks for `has_many :through` associations.
|
101
40
|
|
102
|
-
|
41
|
+
Fixes #33249.
|
103
42
|
|
104
|
-
*
|
43
|
+
*Ryan H. Kerr*
|
105
44
|
|
106
|
-
Specifically, it fixes an issue when using SSL authentication.
|
107
45
|
|
108
|
-
|
46
|
+
## Rails 5.2.3 (March 27, 2019) ##
|
109
47
|
|
48
|
+
* Fix different `count` calculation when using `size` with manual `select` with DISTINCT.
|
110
49
|
|
111
|
-
|
50
|
+
Fixes #35214.
|
112
51
|
|
113
|
-
*
|
114
|
-
the same table definition would only create one foreign key.
|
52
|
+
*Juani Villarejo*
|
115
53
|
|
116
|
-
|
54
|
+
* Fix prepared statements caching to be enabled even when query caching is enabled.
|
117
55
|
|
118
|
-
*
|
119
|
-
clone no longer show as changed attributes in the original object.
|
56
|
+
*Ryuta Kamizono*
|
120
57
|
|
121
|
-
|
58
|
+
* Don't allow `where` with invalid value matches to nil values.
|
122
59
|
|
123
|
-
|
60
|
+
Fixes #33624.
|
124
61
|
|
125
|
-
|
62
|
+
*Ryuta Kamizono*
|
126
63
|
|
127
|
-
|
64
|
+
* Restore an ability that class level `update` without giving ids.
|
128
65
|
|
129
|
-
|
66
|
+
Fixes #34743.
|
130
67
|
|
131
|
-
|
68
|
+
*Ryuta Kamizono*
|
132
69
|
|
133
|
-
|
70
|
+
* Fix join table column quoting with SQLite.
|
134
71
|
|
135
|
-
*
|
136
|
-
These methods determine what relations can be used to back Active Record
|
137
|
-
models (usually tables and views).
|
72
|
+
*Gannon McGibbon*
|
138
73
|
|
139
|
-
|
74
|
+
* Ensure that `delete_all` on collection proxy returns affected count.
|
140
75
|
|
76
|
+
*Ryuta Kamizono*
|
141
77
|
|
142
|
-
|
78
|
+
* Reset scope after delete on collection association to clear stale offsets of removed records.
|
143
79
|
|
144
|
-
*
|
80
|
+
*Gannon McGibbon*
|
145
81
|
|
146
82
|
|
147
|
-
## Rails
|
83
|
+
## Rails 5.2.2.1 (March 11, 2019) ##
|
148
84
|
|
149
85
|
* No changes.
|
150
86
|
|
151
87
|
|
152
|
-
## Rails
|
153
|
-
|
154
|
-
* No longer pass deprecated option `-i` to `pg_dump`.
|
155
|
-
|
156
|
-
*Paul Sadauskas*
|
157
|
-
|
158
|
-
* Set `scope.reordering_value` to `true` if :reordering values are specified.
|
159
|
-
|
160
|
-
Fixes #21886.
|
88
|
+
## Rails 5.2.2 (December 04, 2018) ##
|
161
89
|
|
162
|
-
|
90
|
+
* Do not ignore the scoping with query methods in the scope block.
|
163
91
|
|
164
|
-
*
|
165
|
-
standard_conforming_strings setting. Errors were previously disabled because
|
166
|
-
the setting wasn't writable in Postgres 8.1 and didn't exist in earlier
|
167
|
-
versions. Now Rails only supports Postgres 8.2+ we're fine to assume the
|
168
|
-
setting exists. Disabling errors caused problems when using a connection
|
169
|
-
pooling tool like PgBouncer because it's not guaranteed to have the same
|
170
|
-
connection between calls to `execute` and it could leave the connection
|
171
|
-
with errors disabled.
|
172
|
-
|
173
|
-
Fixes #22101.
|
174
|
-
|
175
|
-
*Harry Marr*
|
176
|
-
|
177
|
-
* Includes HABTM returns correct size now. It's caused by the join dependency
|
178
|
-
only instantiates one HABTM object because the join table hasn't a primary key.
|
179
|
-
|
180
|
-
Fixes #16032.
|
181
|
-
|
182
|
-
Examples:
|
183
|
-
|
184
|
-
before:
|
185
|
-
|
186
|
-
Project.first.salaried_developers.size # => 3
|
187
|
-
Project.includes(:salaried_developers).first.salaried_developers.size # => 1
|
92
|
+
*Ryuta Kamizono*
|
188
93
|
|
189
|
-
|
94
|
+
* Allow aliased attributes to be used in `#update_columns` and `#update`.
|
190
95
|
|
191
|
-
|
192
|
-
Project.includes(:salaried_developers).first.salaried_developers.size # => 3
|
96
|
+
*Gannon McGibbon*
|
193
97
|
|
194
|
-
|
98
|
+
* Allow spaces in postgres table names.
|
195
99
|
|
196
|
-
|
100
|
+
Fixes issue where "user post" is misinterpreted as "\"user\".\"post\"" when quoting table names with the postgres
|
101
|
+
adapter.
|
197
102
|
|
198
|
-
|
103
|
+
*Gannon McGibbon*
|
199
104
|
|
200
|
-
|
105
|
+
* Cached columns_hash fields should be excluded from ResultSet#column_types
|
201
106
|
|
202
|
-
|
203
|
-
|
204
|
-
`Migrator.migrations_paths`.
|
107
|
+
PR #34528 addresses the inconsistent behaviour when attribute is defined for an ignored column. The following test
|
108
|
+
was passing for SQLite and MySQL, but failed for PostgreSQL:
|
205
109
|
|
206
|
-
|
110
|
+
```ruby
|
111
|
+
class DeveloperName < ActiveRecord::Type::String
|
112
|
+
def deserialize(value)
|
113
|
+
"Developer: #{value}"
|
114
|
+
end
|
115
|
+
end
|
207
116
|
|
208
|
-
|
117
|
+
class AttributedDeveloper < ActiveRecord::Base
|
118
|
+
self.table_name = "developers"
|
209
119
|
|
210
|
-
|
120
|
+
attribute :name, DeveloperName.new
|
211
121
|
|
212
|
-
|
122
|
+
self.ignored_columns += ["name"]
|
123
|
+
end
|
213
124
|
|
214
|
-
|
215
|
-
|
216
|
-
shell expansion by using a paramter list instead of string as arguments
|
217
|
-
for Kernel.system(). Thanks to Nate Berkopec for supply patch to get
|
218
|
-
test units passing.
|
125
|
+
developer = AttributedDeveloper.create
|
126
|
+
developer.update_column :name, "name"
|
219
127
|
|
220
|
-
|
128
|
+
loaded_developer = AttributedDeveloper.where(id: developer.id).select("*").first
|
129
|
+
puts loaded_developer.name # should be "Developer: name" but it's just "name"
|
130
|
+
```
|
221
131
|
|
222
|
-
*
|
132
|
+
*Dmitry Tsepelev*
|
223
133
|
|
224
|
-
|
134
|
+
* Values of enum are frozen, raising an error when attempting to modify them.
|
225
135
|
|
226
|
-
*
|
136
|
+
*Emmanuel Byrd*
|
227
137
|
|
228
|
-
*
|
229
|
-
|
138
|
+
* `update_columns` now correctly raises `ActiveModel::MissingAttributeError`
|
139
|
+
if the attribute does not exist.
|
230
140
|
|
231
141
|
*Sean Griffin*
|
232
142
|
|
233
|
-
*
|
234
|
-
|
235
|
-
*Jimmy Bourassa*
|
236
|
-
|
237
|
-
* Ensure `select` quotes aliased attributes, even when using `from`.
|
238
|
-
|
239
|
-
Fixes #21488
|
240
|
-
|
241
|
-
*Sean Griffin & @johanlunds*
|
242
|
-
|
243
|
-
* Correct query for PostgreSQL 8.2 compatibility.
|
244
|
-
|
245
|
-
*Ben Murphy*, *Matthew Draper*
|
246
|
-
|
247
|
-
* Uniqueness validator raises descriptive error when running on a persisted
|
248
|
-
record without primary key.
|
249
|
-
|
250
|
-
Closes #21304.
|
143
|
+
* Do not use prepared statement in queries that have a large number of binds.
|
251
144
|
|
252
|
-
*
|
253
|
-
|
254
|
-
|
255
|
-
## Rails 4.2.4 (August 24, 2015) ##
|
256
|
-
|
257
|
-
* Skip statement cache on through association reader.
|
258
|
-
|
259
|
-
If the through class has default scopes we should skip the statement
|
260
|
-
cache.
|
261
|
-
|
262
|
-
Closes #20745.
|
263
|
-
|
264
|
-
*Rafael Mendonça França*
|
265
|
-
|
266
|
-
* Fixes #19420. When generating schema.rb using Postgres BigInt[] data type
|
267
|
-
the limit: 8 was not coming through. This caused it to become Int[] data type
|
268
|
-
after doing a rebuild off of schema.rb.
|
269
|
-
|
270
|
-
*Jake Waller*
|
271
|
-
|
272
|
-
* Fix state being carried over from previous transaction.
|
273
|
-
|
274
|
-
Considering the following example where `name` is a required attribute.
|
275
|
-
Before we had `new_record?` returning `true` for a persisted record:
|
276
|
-
|
277
|
-
author = Author.create! name: 'foo'
|
278
|
-
author.name = nil
|
279
|
-
author.save # => false
|
280
|
-
author.new_record? # => true
|
281
|
-
|
282
|
-
Fixes #20824.
|
283
|
-
|
284
|
-
*Roque Pinel*
|
145
|
+
*Ryuta Kamizono*
|
285
146
|
|
286
|
-
*
|
287
|
-
when validating associations.
|
147
|
+
* Fix query cache to load before first request.
|
288
148
|
|
289
|
-
|
149
|
+
*Eileen M. Uchitelle*
|
290
150
|
|
291
|
-
|
151
|
+
* Fix collection cache key with limit and custom select to avoid ambiguous timestamp column error.
|
292
152
|
|
293
|
-
|
294
|
-
times.
|
153
|
+
Fixes #33056.
|
295
154
|
|
296
|
-
|
297
|
-
Fixes #20727.
|
155
|
+
*Federico Martinez*
|
298
156
|
|
299
|
-
|
157
|
+
* Fix duplicated record creation when using nested attributes with `create_with`.
|
300
158
|
|
301
|
-
*
|
302
|
-
other than `db:migrate`. (eg. `db:rollback`, `db:migrate:dup`, ...)
|
159
|
+
*Darwin Wu*
|
303
160
|
|
304
|
-
|
161
|
+
* Fix regression setting children record in parent `before_save` callback.
|
305
162
|
|
306
|
-
*
|
163
|
+
*Guo Xiang Tan*
|
307
164
|
|
308
|
-
*
|
309
|
-
a wrong type to a namespaced association.
|
165
|
+
* Prevent leaking of user's DB credentials on `rails db:create` failure.
|
310
166
|
|
311
|
-
|
167
|
+
*bogdanvlviv*
|
312
168
|
|
313
|
-
|
169
|
+
* Clear mutation tracker before continuing the around callbacks.
|
314
170
|
|
315
|
-
*
|
316
|
-
belongs_to association.
|
171
|
+
*Yuya Tanaka*
|
317
172
|
|
318
|
-
|
173
|
+
* Prevent deadlocks when waiting for connection from pool.
|
319
174
|
|
320
|
-
*
|
175
|
+
*Brent Wheeldon*
|
321
176
|
|
177
|
+
* Avoid extra scoping when using `Relation#update` that was causing this method to change the current scope.
|
322
178
|
|
323
|
-
|
179
|
+
*Ryuta Kamizono*
|
324
180
|
|
325
|
-
*
|
181
|
+
* Fix numericality validator not to be affected by custom getter.
|
326
182
|
|
327
|
-
*
|
183
|
+
*Ryuta Kamizono*
|
328
184
|
|
329
|
-
* Fix
|
185
|
+
* Fix bulk change table ignores comment option on PostgreSQL.
|
330
186
|
|
331
|
-
*
|
187
|
+
*Yoshiyuki Kinjo*
|
332
188
|
|
333
|
-
* Fixed an error which would occur in dirty checking when calling
|
334
|
-
`update_attributes` from a getter.
|
335
189
|
|
336
|
-
|
190
|
+
## Rails 5.2.1.1 (November 27, 2018) ##
|
337
191
|
|
338
|
-
|
192
|
+
* No changes.
|
339
193
|
|
340
|
-
* Ensure symbols passed to `ActiveRecord::Relation#select` are always treated
|
341
|
-
as columns.
|
342
194
|
|
343
|
-
|
195
|
+
## Rails 5.2.1 (August 07, 2018) ##
|
344
196
|
|
345
|
-
|
197
|
+
* PostgreSQL: Support new relkind for partitioned tables.
|
346
198
|
|
347
|
-
|
199
|
+
Fixes #33008.
|
348
200
|
|
349
|
-
*
|
201
|
+
*Yannick Schutz*
|
350
202
|
|
351
|
-
*
|
352
|
-
underlying `has_many :through`.
|
203
|
+
* Rollback parent transaction when children fails to update.
|
353
204
|
|
354
|
-
*
|
205
|
+
*Guillaume Malette*
|
355
206
|
|
356
|
-
*
|
207
|
+
* Fix default value for MySQL time types with specified precision.
|
357
208
|
|
358
|
-
*
|
209
|
+
*Nikolay Kondratyev*
|
359
210
|
|
360
|
-
*
|
361
|
-
environment. This ensures that initializers are run.
|
211
|
+
* Fix `touch` option to behave consistently with `Persistence#touch` method.
|
362
212
|
|
363
|
-
|
213
|
+
*Ryuta Kamizono*
|
364
214
|
|
365
|
-
|
215
|
+
* Fix `save` in `after_create_commit` won't invoke extra `after_create_commit`.
|
366
216
|
|
367
|
-
|
217
|
+
Fixes #32831.
|
368
218
|
|
369
|
-
|
370
|
-
`column` definitions for `created_at` and `updated_at` rather than just
|
371
|
-
the first.
|
219
|
+
*Ryuta Kamizono*
|
372
220
|
|
373
|
-
|
221
|
+
* Fix logic on disabling commit callbacks so they are not called unexpectedly when errors occur.
|
374
222
|
|
375
|
-
*
|
223
|
+
*Brian Durand*
|
376
224
|
|
377
|
-
|
225
|
+
* Fix parent record should not get saved with duplicate children records.
|
378
226
|
|
379
|
-
|
227
|
+
Fixes #32940.
|
380
228
|
|
381
|
-
*
|
382
|
-
even if an validation should have prevented it from hitting the database.
|
229
|
+
*Santosh Wadghule*
|
383
230
|
|
384
|
-
|
231
|
+
* Fix that association's after_touch is not called with counter cache.
|
385
232
|
|
386
|
-
|
387
|
-
`ActiveRecord::Base.pluralize_table_names = false`.
|
233
|
+
Fixes #31559.
|
388
234
|
|
389
|
-
|
235
|
+
*Ryuta Kamizono*
|
390
236
|
|
391
|
-
|
237
|
+
* `becomes` should clear the mutation tracker which is created in `after_initialize`.
|
392
238
|
|
393
|
-
|
239
|
+
Fixes #32867.
|
394
240
|
|
395
|
-
|
241
|
+
*Ryuta Kamizono*
|
396
242
|
|
397
|
-
|
243
|
+
* Allow a belonging to parent object to be created from a new record.
|
398
244
|
|
399
|
-
*
|
400
|
-
association (only when calling calculation methods).
|
245
|
+
*Jolyon Pawlyn*
|
401
246
|
|
402
|
-
|
247
|
+
* Fix that building record with assigning multiple has_one associations
|
248
|
+
wrongly persists through record.
|
403
249
|
|
404
|
-
|
250
|
+
Fixes #32511.
|
405
251
|
|
406
|
-
*
|
252
|
+
*Sam DeCesare*
|
407
253
|
|
408
|
-
|
254
|
+
* Fix relation merging when one of the relations is going to skip the
|
255
|
+
query cache.
|
409
256
|
|
410
|
-
*
|
257
|
+
*James Williams*
|
411
258
|
|
412
|
-
* Correctly persist a serialized attribute that has been returned to
|
413
|
-
its default value by an in-place modification.
|
414
259
|
|
415
|
-
|
260
|
+
## Rails 5.2.0 (April 09, 2018) ##
|
416
261
|
|
417
|
-
|
262
|
+
* MySQL: Support mysql2 0.5.x.
|
418
263
|
|
419
|
-
*
|
264
|
+
*Aaron Stone*
|
420
265
|
|
421
|
-
|
266
|
+
* Apply time column precision on assignment.
|
422
267
|
|
423
|
-
|
424
|
-
|
268
|
+
PR #20317 changed the behavior of datetime columns so that when they
|
269
|
+
have a specified precision then on assignment the value is rounded to
|
270
|
+
that precision. This behavior is now applied to time columns as well.
|
425
271
|
|
426
|
-
Fixes #
|
272
|
+
Fixes #30301.
|
427
273
|
|
428
|
-
*
|
274
|
+
*Andrew White*
|
429
275
|
|
430
|
-
*
|
431
|
-
association when using `where`.
|
276
|
+
* Normalize time column values for SQLite database.
|
432
277
|
|
433
|
-
|
278
|
+
For legacy reasons, time columns in SQLite are stored as full datetimes
|
279
|
+
because until #24542 the quoting for time columns didn't remove the date
|
280
|
+
component. To ensure that values are consistent we now normalize the
|
281
|
+
date component to 2001-01-01 on reading and writing.
|
434
282
|
|
435
|
-
*
|
283
|
+
*Andrew White*
|
436
284
|
|
285
|
+
* Ensure that the date component is removed when quoting times.
|
437
286
|
|
438
|
-
|
287
|
+
PR #24542 altered the quoting for time columns so that the date component
|
288
|
+
was removed however it only removed it when it was 2001-01-01. Now the
|
289
|
+
date component is removed irrespective of what the date is.
|
439
290
|
|
440
|
-
*
|
291
|
+
*Andrew White*
|
441
292
|
|
293
|
+
* Fix `dependent: :destroy` issue for has_one/belongs_to relationship where
|
294
|
+
the parent class was getting deleted when the child was not.
|
442
295
|
|
443
|
-
|
296
|
+
Fixes #32022.
|
444
297
|
|
445
|
-
*
|
298
|
+
*Fernando Gorodscy*
|
446
299
|
|
447
|
-
|
300
|
+
* Whitelist `NULLS FIRST` and `NULLS LAST` in order clauses too.
|
448
301
|
|
449
|
-
*
|
302
|
+
*Xavier Noria*
|
450
303
|
|
451
|
-
*
|
452
|
-
removing the column. This fixes a bug where it was not possible to remove
|
453
|
-
the column on MySQL.
|
304
|
+
* Fix that after commit callbacks on update does not triggered when optimistic locking is enabled.
|
454
305
|
|
455
|
-
|
306
|
+
*Ryuta Kamizono*
|
456
307
|
|
457
|
-
|
308
|
+
* Fix `#columns_for_distinct` of MySQL and PostgreSQL to make
|
309
|
+
`ActiveRecord::FinderMethods#limited_ids_for` use correct primary key values
|
310
|
+
even if `ORDER BY` columns include other table's primary key.
|
458
311
|
|
459
|
-
|
460
|
-
methods. The model and migration generators now use this option, rather than
|
461
|
-
the `add_foreign_key` form.
|
312
|
+
Fixes #28364.
|
462
313
|
|
463
|
-
*
|
314
|
+
*Takumi Kagiyama*
|
464
315
|
|
465
|
-
*
|
316
|
+
* Make `reflection.klass` raise if `polymorphic?` not to be misused.
|
466
317
|
|
467
|
-
|
468
|
-
the precision of timestamp column.
|
318
|
+
Fixes #31876.
|
469
319
|
|
470
320
|
*Ryuta Kamizono*
|
471
321
|
|
472
|
-
*
|
322
|
+
* PostgreSQL: Allow pg-1.0 gem to be used with Active Record.
|
323
|
+
|
324
|
+
*Lars Kanis*
|
473
325
|
|
474
|
-
|
475
|
-
|
476
|
-
of the connection.
|
326
|
+
* Deprecate `expand_hash_conditions_for_aggregates` without replacement.
|
327
|
+
Using a `Relation` for performing queries is the prefered API.
|
477
328
|
|
478
329
|
*Ryuta Kamizono*
|
479
330
|
|
480
|
-
*
|
331
|
+
* Fix not expanded problem when passing an Array object as argument to the where method using `composed_of` column.
|
481
332
|
|
482
|
-
|
333
|
+
```
|
334
|
+
david_balance = customers(:david).balance
|
335
|
+
Customer.where(balance: [david_balance]).to_sql
|
483
336
|
|
484
|
-
|
337
|
+
# Before: WHERE `customers`.`balance` = NULL
|
338
|
+
# After : WHERE `customers`.`balance` = 50
|
339
|
+
```
|
485
340
|
|
486
|
-
|
487
|
-
twice or not updating at all for `has_many` and `has_many :through`.
|
341
|
+
Fixes #31723.
|
488
342
|
|
489
|
-
|
343
|
+
*Yutaro Kanagawa*
|
490
344
|
|
491
|
-
|
345
|
+
* Fix `count(:all)` with eager loading and having an order other than the driving table.
|
492
346
|
|
493
|
-
|
494
|
-
meant a different `structure.sql` would be generated every time a developer
|
495
|
-
ran migrations on their machine.
|
347
|
+
Fixes #31783.
|
496
348
|
|
497
|
-
|
498
|
-
column name, which is consistent every time you run the migration.
|
349
|
+
*Ryuta Kamizono*
|
499
350
|
|
500
|
-
|
351
|
+
* Clear the transaction state when an Active Record object is duped.
|
501
352
|
|
502
|
-
|
353
|
+
Fixes #31670.
|
503
354
|
|
504
|
-
|
505
|
-
Property.group(:value).count
|
355
|
+
*Yuriy Ustushenko*
|
506
356
|
|
507
|
-
|
357
|
+
* Support for PostgreSQL foreign tables.
|
508
358
|
|
509
|
-
*
|
510
|
-
`accepts_nested_attributes_for`.
|
359
|
+
*fatkodima*
|
511
360
|
|
512
|
-
|
361
|
+
* Fix relation merger issue with `left_outer_joins`.
|
513
362
|
|
514
|
-
*
|
363
|
+
*Mehmet Emin İNAÇ*
|
515
364
|
|
516
|
-
*
|
517
|
-
attribute, but will instead raise when going to the database.
|
365
|
+
* Don't allow destroyed object mutation after `save` or `save!` is called.
|
518
366
|
|
519
|
-
|
520
|
-
commit message from the commit which added this line for some examples.
|
367
|
+
*Ryuta Kamizono*
|
521
368
|
|
522
|
-
|
369
|
+
* Take into account association conditions when deleting through records.
|
523
370
|
|
524
|
-
|
525
|
-
ASCII-8BIT string with invalid UTF-8 bytes on Sqlite3), no longer error on
|
526
|
-
assignment. They will still error when sent to the database, but you are
|
527
|
-
given the ability to re-assign it to a valid value.
|
371
|
+
Fixes #18424.
|
528
372
|
|
529
|
-
|
373
|
+
*Piotr Jakubowski*
|
530
374
|
|
531
|
-
|
375
|
+
* Fix nested `has_many :through` associations on unpersisted parent instances.
|
532
376
|
|
533
|
-
|
377
|
+
For example, if you have
|
534
378
|
|
535
|
-
|
379
|
+
class Post < ActiveRecord::Base
|
380
|
+
belongs_to :author
|
381
|
+
has_many :books, through: :author
|
382
|
+
has_many :subscriptions, through: :books
|
383
|
+
end
|
536
384
|
|
537
|
-
|
385
|
+
class Author < ActiveRecord::Base
|
386
|
+
has_one :post
|
387
|
+
has_many :books
|
388
|
+
has_many :subscriptions, through: :books
|
389
|
+
end
|
538
390
|
|
539
|
-
|
391
|
+
class Book < ActiveRecord::Base
|
392
|
+
belongs_to :author
|
393
|
+
has_many :subscriptions
|
394
|
+
end
|
540
395
|
|
541
|
-
|
396
|
+
class Subscription < ActiveRecord::Base
|
397
|
+
belongs_to :book
|
398
|
+
end
|
542
399
|
|
543
|
-
|
400
|
+
Before:
|
544
401
|
|
545
|
-
|
546
|
-
Previously every scope with extension methods was transformed into an
|
547
|
-
instance dependent scope. Including such a scope would wrongfully issue a
|
548
|
-
deprecation warning. This is no longer the case.
|
402
|
+
If `post` is not persisted, then `post.subscriptions` will be empty.
|
549
403
|
|
550
|
-
|
404
|
+
After:
|
551
405
|
|
552
|
-
|
406
|
+
If `post` is not persisted, then `post.subscriptions` can be set and used
|
407
|
+
just like it would if `post` were persisted.
|
553
408
|
|
554
|
-
|
555
|
-
optimistic locking.
|
409
|
+
Fixes #16313.
|
556
410
|
|
557
|
-
|
411
|
+
*Zoltan Kiss*
|
558
412
|
|
559
|
-
|
413
|
+
* Fixed inconsistency with `first(n)` when used with `limit()`.
|
414
|
+
The `first(n)` finder now respects the `limit()`, making it consistent
|
415
|
+
with `relation.to_a.first(n)`, and also with the behavior of `last(n)`.
|
560
416
|
|
561
|
-
|
562
|
-
be sent to the database.
|
417
|
+
Fixes #23979.
|
563
418
|
|
564
|
-
|
419
|
+
*Brian Christian*
|
565
420
|
|
566
|
-
|
421
|
+
* Use `count(:all)` in `HasManyAssociation#count_records` to prevent invalid
|
422
|
+
SQL queries for association counting.
|
567
423
|
|
568
|
-
*
|
424
|
+
*Klas Eskilson*
|
569
425
|
|
570
|
-
|
426
|
+
* Fix to invoke callbacks when using `update_attribute`.
|
571
427
|
|
572
|
-
|
573
|
-
is ignored. In 5.6, it's rounded to `2014-08-17 12:30:01`:
|
428
|
+
*Mike Busch*
|
574
429
|
|
575
|
-
|
430
|
+
* Fix `count(:all)` to correctly work `distinct` with custom SELECT list.
|
576
431
|
|
577
432
|
*Ryuta Kamizono*
|
578
433
|
|
579
|
-
*
|
434
|
+
* Using subselect for `delete_all` with `limit` or `offset`.
|
580
435
|
|
581
436
|
*Ryuta Kamizono*
|
582
437
|
|
583
|
-
*
|
584
|
-
|
585
|
-
*Florian Weingarten*
|
586
|
-
|
587
|
-
* Fixed setting of foreign_key for through associations while building of new record.
|
588
|
-
|
589
|
-
Fixes #12698.
|
590
|
-
|
591
|
-
*Ivan Antropov*
|
592
|
-
|
593
|
-
* Fixed automatic inverse_of for models nested in module.
|
594
|
-
|
595
|
-
*Andrew McCloud*
|
438
|
+
* Undefine attribute methods on descendants when resetting column
|
439
|
+
information.
|
596
440
|
|
597
|
-
*
|
441
|
+
*Chris Salzberg*
|
598
442
|
|
599
|
-
|
443
|
+
* Log database query callers.
|
600
444
|
|
601
|
-
|
445
|
+
Add `verbose_query_logs` configuration option to display the caller
|
446
|
+
of database queries in the log to facilitate N+1 query resolution
|
447
|
+
and other debugging.
|
602
448
|
|
603
|
-
|
604
|
-
|
449
|
+
Enabled in development only for new and upgraded applications. Not
|
450
|
+
recommended for use in the production environment since it relies
|
451
|
+
on Ruby's `Kernel#caller_locations` which is fairly slow.
|
605
452
|
|
606
|
-
|
453
|
+
*Olivier Lacan*
|
607
454
|
|
608
|
-
|
455
|
+
* Fix conflicts `counter_cache` with `touch: true` by optimistic locking.
|
609
456
|
|
610
|
-
|
457
|
+
```
|
458
|
+
# create_table :posts do |t|
|
459
|
+
# t.integer :comments_count, default: 0
|
460
|
+
# t.integer :lock_version
|
461
|
+
# t.timestamps
|
462
|
+
# end
|
463
|
+
class Post < ApplicationRecord
|
464
|
+
end
|
611
465
|
|
612
|
-
|
466
|
+
# create_table :comments do |t|
|
467
|
+
# t.belongs_to :post
|
468
|
+
# end
|
469
|
+
class Comment < ApplicationRecord
|
470
|
+
belongs_to :post, touch: true, counter_cache: true
|
471
|
+
end
|
472
|
+
```
|
613
473
|
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
474
|
+
Before:
|
475
|
+
```
|
476
|
+
post = Post.create!
|
477
|
+
# => begin transaction
|
478
|
+
INSERT INTO "posts" ("created_at", "updated_at", "lock_version")
|
479
|
+
VALUES ("2017-12-11 21:27:11.387397", "2017-12-11 21:27:11.387397", 0)
|
480
|
+
commit transaction
|
481
|
+
|
482
|
+
comment = Comment.create!(post: post)
|
483
|
+
# => begin transaction
|
484
|
+
INSERT INTO "comments" ("post_id") VALUES (1)
|
485
|
+
|
486
|
+
UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1,
|
487
|
+
"lock_version" = COALESCE("lock_version", 0) + 1 WHERE "posts"."id" = 1
|
488
|
+
|
489
|
+
UPDATE "posts" SET "updated_at" = '2017-12-11 21:27:11.398330',
|
490
|
+
"lock_version" = 1 WHERE "posts"."id" = 1 AND "posts"."lock_version" = 0
|
491
|
+
rollback transaction
|
492
|
+
# => ActiveRecord::StaleObjectError: Attempted to touch a stale object: Post.
|
493
|
+
|
494
|
+
Comment.take.destroy!
|
495
|
+
# => begin transaction
|
496
|
+
DELETE FROM "comments" WHERE "comments"."id" = 1
|
497
|
+
|
498
|
+
UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) - 1,
|
499
|
+
"lock_version" = COALESCE("lock_version", 0) + 1 WHERE "posts"."id" = 1
|
500
|
+
|
501
|
+
UPDATE "posts" SET "updated_at" = '2017-12-11 21:42:47.785901',
|
502
|
+
"lock_version" = 1 WHERE "posts"."id" = 1 AND "posts"."lock_version" = 0
|
503
|
+
rollback transaction
|
504
|
+
# => ActiveRecord::StaleObjectError: Attempted to touch a stale object: Post.
|
505
|
+
```
|
637
506
|
|
638
|
-
|
507
|
+
After:
|
508
|
+
```
|
509
|
+
post = Post.create!
|
510
|
+
# => begin transaction
|
511
|
+
INSERT INTO "posts" ("created_at", "updated_at", "lock_version")
|
512
|
+
VALUES ("2017-12-11 21:27:11.387397", "2017-12-11 21:27:11.387397", 0)
|
513
|
+
commit transaction
|
639
514
|
|
640
|
-
|
515
|
+
comment = Comment.create!(post: post)
|
516
|
+
# => begin transaction
|
517
|
+
INSERT INTO "comments" ("post_id") VALUES (1)
|
641
518
|
|
642
|
-
|
643
|
-
|
519
|
+
UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1,
|
520
|
+
"lock_version" = COALESCE("lock_version", 0) + 1,
|
521
|
+
"updated_at" = '2017-12-11 21:37:09.802642' WHERE "posts"."id" = 1
|
522
|
+
commit transaction
|
644
523
|
|
645
|
-
|
524
|
+
comment.destroy!
|
525
|
+
# => begin transaction
|
526
|
+
DELETE FROM "comments" WHERE "comments"."id" = 1
|
646
527
|
|
647
|
-
|
648
|
-
|
528
|
+
UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) - 1,
|
529
|
+
"lock_version" = COALESCE("lock_version", 0) + 1,
|
530
|
+
"updated_at" = '2017-12-11 21:39:02.685520' WHERE "posts"."id" = 1
|
531
|
+
commit transaction
|
532
|
+
```
|
649
533
|
|
650
|
-
Fixes #
|
534
|
+
Fixes #31199.
|
651
535
|
|
652
|
-
*
|
536
|
+
*bogdanvlviv*
|
653
537
|
|
538
|
+
* Add support for PostgreSQL operator classes to `add_index`.
|
654
539
|
|
655
|
-
|
540
|
+
Example:
|
656
541
|
|
657
|
-
|
658
|
-
will recreate tables even if they have dependent objects (like foreign keys).
|
659
|
-
`db/schema.rb` now uses `force: :cascade`. This makes it possible to
|
660
|
-
reload the schema when foreign keys are in place.
|
542
|
+
add_index :users, :name, using: :gist, opclass: { name: :gist_trgm_ops }
|
661
543
|
|
662
|
-
*
|
544
|
+
*Greg Navis*
|
663
545
|
|
664
|
-
*
|
665
|
-
before loading the schema. This is left for the user to do.
|
666
|
-
`db:test:prepare` will still purge the database.
|
546
|
+
* Don't allow scopes to be defined which conflict with instance methods on `Relation`.
|
667
547
|
|
668
|
-
Fixes #
|
548
|
+
Fixes #31120.
|
669
549
|
|
670
|
-
*
|
550
|
+
*kinnrot*
|
671
551
|
|
672
|
-
*
|
552
|
+
* Add new error class `QueryCanceled` which will be raised
|
553
|
+
when canceling statement due to user request.
|
673
554
|
|
674
555
|
*Ryuta Kamizono*
|
675
556
|
|
676
|
-
* Add `
|
557
|
+
* Add `#up_only` to database migrations for code that is only relevant when
|
558
|
+
migrating up, e.g. populating a new column.
|
677
559
|
|
678
|
-
|
560
|
+
*Rich Daley*
|
679
561
|
|
680
|
-
|
562
|
+
* Require raw SQL fragments to be explicitly marked when used in
|
563
|
+
relation query methods.
|
681
564
|
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
* Bring back `db:test:prepare` to synchronize the test database schema.
|
688
|
-
|
689
|
-
Manual synchronization using `bin/rake db:test:prepare` is required
|
690
|
-
when a migration is rolled-back, edited and reapplied.
|
691
|
-
|
692
|
-
`ActiveRecord::Base.maintain_test_schema` now uses `db:test:prepare`
|
693
|
-
to synchronize the schema. Plugins can use this task as a hook to
|
694
|
-
provide custom behavior after the schema has been loaded.
|
695
|
-
|
696
|
-
NOTE: `test:prepare` runs before the schema is synchronized.
|
697
|
-
|
698
|
-
Fixes #17171, #15787.
|
565
|
+
Before:
|
566
|
+
```
|
567
|
+
Article.order("LENGTH(title)")
|
568
|
+
```
|
699
569
|
|
700
|
-
|
570
|
+
After:
|
571
|
+
```
|
572
|
+
Article.order(Arel.sql("LENGTH(title)"))
|
573
|
+
```
|
701
574
|
|
702
|
-
|
575
|
+
This prevents SQL injection if applications use the [strongly
|
576
|
+
discouraged] form `Article.order(params[:my_order])`, under the
|
577
|
+
mistaken belief that only column names will be accepted.
|
703
578
|
|
704
|
-
|
579
|
+
Raw SQL strings will now cause a deprecation warning, which will
|
580
|
+
become an UnknownAttributeReference error in Rails 6.0. Applications
|
581
|
+
can opt in to the future behavior by setting `allow_unsafe_raw_sql`
|
582
|
+
to `:disabled`.
|
705
583
|
|
706
|
-
|
584
|
+
Common and judged-safe string values (such as simple column
|
585
|
+
references) are unaffected:
|
586
|
+
```
|
587
|
+
Article.order("title DESC")
|
588
|
+
```
|
707
589
|
|
708
|
-
*
|
590
|
+
*Ben Toews*
|
709
591
|
|
710
|
-
|
592
|
+
* `update_all` will now pass its values to `Type#cast` before passing them to
|
593
|
+
`Type#serialize`. This means that `update_all(foo: 'true')` will properly
|
594
|
+
persist a boolean.
|
711
595
|
|
712
596
|
*Sean Griffin*
|
713
597
|
|
714
|
-
*
|
715
|
-
|
716
|
-
*Yves Senn*
|
717
|
-
|
718
|
-
* Fix preloading of associations with a scope containing joins along with
|
719
|
-
conditions on the joined association.
|
720
|
-
|
721
|
-
*Siddharth Sharma*
|
722
|
-
|
723
|
-
* Add `Table#name` to match `TableDefinition#name`.
|
724
|
-
|
725
|
-
*Cody Cutrer*
|
726
|
-
|
727
|
-
* Cache `CollectionAssociation#reader` proxies separately before and after
|
728
|
-
the owner has been saved so that the proxy is not cached without the
|
729
|
-
owner's id.
|
730
|
-
|
731
|
-
*Ben Woosley*
|
732
|
-
|
733
|
-
* `ActiveRecord::ReadOnlyRecord` now has a descriptive message.
|
598
|
+
* Add new error class `StatementTimeout` which will be raised
|
599
|
+
when statement timeout exceeded.
|
734
600
|
|
735
|
-
*
|
736
|
-
|
737
|
-
* Fix preloading of associations which unscope a default scope.
|
738
|
-
|
739
|
-
Fixes #11036.
|
740
|
-
|
741
|
-
*Byron Bischoff*
|
742
|
-
|
743
|
-
* Added SchemaDumper support for tables with jsonb columns.
|
744
|
-
|
745
|
-
*Ted O'Meara*
|
746
|
-
|
747
|
-
* Deprecate `sanitize_sql_hash_for_conditions` without replacement. Using a
|
748
|
-
`Relation` for performing queries and updates is the prefered API.
|
601
|
+
*Ryuta Kamizono*
|
749
602
|
|
750
|
-
|
603
|
+
* Fix `bin/rails db:migrate` with specified `VERSION`.
|
604
|
+
`bin/rails db:migrate` with empty VERSION behaves as without `VERSION`.
|
605
|
+
Check a format of `VERSION`: Allow a migration version number
|
606
|
+
or name of a migration file. Raise error if format of `VERSION` is invalid.
|
607
|
+
Raise error if target migration doesn't exist.
|
751
608
|
|
752
|
-
*
|
753
|
-
even when using type decorators such as `serialize`.
|
609
|
+
*bogdanvlviv*
|
754
610
|
|
755
|
-
|
611
|
+
* Fixed a bug where column orders for an index weren't written to
|
612
|
+
`db/schema.rb` when using the sqlite adapter.
|
756
613
|
|
757
|
-
|
758
|
-
in an endless loop.
|
614
|
+
Fixes #30902.
|
759
615
|
|
760
|
-
|
616
|
+
*Paul Kuruvilla*
|
761
617
|
|
762
|
-
|
618
|
+
* Remove deprecated method `#sanitize_conditions`.
|
763
619
|
|
764
|
-
*
|
620
|
+
*Rafael Mendonça França*
|
765
621
|
|
766
|
-
|
622
|
+
* Remove deprecated method `#scope_chain`.
|
767
623
|
|
768
|
-
*
|
624
|
+
*Rafael Mendonça França*
|
769
625
|
|
770
|
-
|
626
|
+
* Remove deprecated configuration `.error_on_ignored_order_or_limit`.
|
771
627
|
|
772
|
-
*
|
628
|
+
*Rafael Mendonça França*
|
773
629
|
|
774
|
-
|
630
|
+
* Remove deprecated arguments from `#verify!`.
|
775
631
|
|
776
|
-
*
|
632
|
+
*Rafael Mendonça França*
|
777
633
|
|
778
|
-
|
779
|
-
# => ActiveRecord::UnknownAttributeError: unknown attribute 'name' for User.
|
634
|
+
* Remove deprecated argument `name` from `#indexes`.
|
780
635
|
|
781
|
-
*
|
636
|
+
*Rafael Mendonça França*
|
782
637
|
|
783
|
-
*
|
784
|
-
records are autosaved.
|
638
|
+
* Remove deprecated method `ActiveRecord::Migrator.schema_migrations_table_name`.
|
785
639
|
|
786
|
-
|
640
|
+
*Rafael Mendonça França*
|
787
641
|
|
788
|
-
|
642
|
+
* Remove deprecated method `supports_primary_key?`.
|
789
643
|
|
790
|
-
*
|
791
|
-
management middleware.
|
644
|
+
*Rafael Mendonça França*
|
792
645
|
|
793
|
-
|
646
|
+
* Remove deprecated method `supports_migrations?`.
|
794
647
|
|
795
|
-
*
|
648
|
+
*Rafael Mendonça França*
|
796
649
|
|
797
|
-
|
650
|
+
* Remove deprecated methods `initialize_schema_migrations_table` and `initialize_internal_metadata_table`.
|
798
651
|
|
799
|
-
*
|
652
|
+
*Rafael Mendonça França*
|
800
653
|
|
801
|
-
|
654
|
+
* Raises when calling `lock!` in a dirty record.
|
802
655
|
|
803
|
-
*
|
656
|
+
*Rafael Mendonça França*
|
804
657
|
|
805
|
-
|
658
|
+
* Remove deprecated support to passing a class to `:class_name` on associations.
|
806
659
|
|
807
|
-
*
|
808
|
-
outside the schema search path.
|
660
|
+
*Rafael Mendonça França*
|
809
661
|
|
810
|
-
|
662
|
+
* Remove deprecated argument `default` from `index_name_exists?`.
|
811
663
|
|
812
|
-
*
|
664
|
+
*Rafael Mendonça França*
|
813
665
|
|
814
|
-
*
|
815
|
-
committing it during the stack unwind. Previously, we could commit half-
|
816
|
-
completed work. This fix only works for Ruby 2.0+; on 1.9, we can't
|
817
|
-
distinguish a thread kill from an ordinary non-local (block) return, so must
|
818
|
-
default to committing.
|
666
|
+
* Remove deprecated support to `quoted_id` when typecasting an Active Record object.
|
819
667
|
|
820
|
-
*
|
668
|
+
*Rafael Mendonça França*
|
821
669
|
|
822
|
-
*
|
823
|
-
|
670
|
+
* Fix `bin/rails db:setup` and `bin/rails db:test:prepare` create wrong
|
671
|
+
ar_internal_metadata's data for a test database.
|
824
672
|
|
825
|
-
|
673
|
+
Before:
|
674
|
+
```
|
675
|
+
$ RAILS_ENV=test rails dbconsole
|
676
|
+
> SELECT * FROM ar_internal_metadata;
|
677
|
+
key|value|created_at|updated_at
|
678
|
+
environment|development|2017-09-11 23:14:10.815679|2017-09-11 23:14:10.815679
|
679
|
+
```
|
826
680
|
|
827
|
-
|
681
|
+
After:
|
682
|
+
```
|
683
|
+
$ RAILS_ENV=test rails dbconsole
|
684
|
+
> SELECT * FROM ar_internal_metadata;
|
685
|
+
key|value|created_at|updated_at
|
686
|
+
environment|test|2017-09-11 23:14:10.815679|2017-09-11 23:14:10.815679
|
687
|
+
```
|
828
688
|
|
829
|
-
|
830
|
-
in the future without affecting old migrations that assumed old defaults.
|
689
|
+
Fixes #26731.
|
831
690
|
|
832
|
-
*
|
691
|
+
*bogdanvlviv*
|
833
692
|
|
834
|
-
*
|
693
|
+
* Fix longer sequence name detection for serial columns.
|
835
694
|
|
836
|
-
|
695
|
+
Fixes #28332.
|
837
696
|
|
838
|
-
*
|
697
|
+
*Ryuta Kamizono*
|
839
698
|
|
840
|
-
|
699
|
+
* MySQL: Don't lose `auto_increment: true` in the `db/schema.rb`.
|
841
700
|
|
842
|
-
|
701
|
+
Fixes #30894.
|
843
702
|
|
844
|
-
*
|
703
|
+
*Ryuta Kamizono*
|
845
704
|
|
846
|
-
*
|
847
|
-
has support for SQL views. Connection adapters should define this method.
|
705
|
+
* Fix `COUNT(DISTINCT ...)` for `GROUP BY` with `ORDER BY` and `LIMIT`.
|
848
706
|
|
849
|
-
|
707
|
+
Fixes #30886.
|
850
708
|
|
851
|
-
*
|
709
|
+
*Ryuta Kamizono*
|
852
710
|
|
853
|
-
|
711
|
+
* PostgreSQL `tsrange` now preserves subsecond precision.
|
854
712
|
|
855
|
-
|
713
|
+
PostgreSQL 9.1+ introduced range types, and Rails added support for using
|
714
|
+
this datatype in Active Record. However, the serialization of
|
715
|
+
`PostgreSQL::OID::Range` was incomplete, because it did not properly
|
716
|
+
cast the bounds that make up the range. This led to subseconds being
|
717
|
+
dropped in SQL commands:
|
856
718
|
|
857
|
-
|
858
|
-
the database connection to the current environment.
|
719
|
+
Before:
|
859
720
|
|
860
|
-
|
721
|
+
connection.type_cast(tsrange.serialize(range_value))
|
722
|
+
# => "[2010-01-01 13:30:00 UTC,2011-02-02 19:30:00 UTC)"
|
861
723
|
|
862
|
-
|
724
|
+
Now:
|
863
725
|
|
864
|
-
|
726
|
+
connection.type_cast(tsrange.serialize(range_value))
|
727
|
+
# => "[2010-01-01 13:30:00.670277,2011-02-02 19:30:00.745125)"
|
865
728
|
|
866
|
-
|
867
|
-
database.yml. Otherwise, `SET NAMES utf8mb4` will use the default
|
868
|
-
collation for that charset (utf8mb4_general_ci) when you may have chosen
|
869
|
-
a different collation, like utf8mb4_unicode_ci.
|
729
|
+
*Thomas Cannon*
|
870
730
|
|
871
|
-
|
872
|
-
|
731
|
+
* Passing a `Set` to `Relation#where` now behaves the same as passing an
|
732
|
+
array.
|
873
733
|
|
874
|
-
*
|
734
|
+
*Sean Griffin*
|
875
735
|
|
876
|
-
*
|
736
|
+
* Use given algorithm while removing index from database.
|
877
737
|
|
878
|
-
|
738
|
+
Fixes #24190.
|
879
739
|
|
880
|
-
*
|
881
|
-
PostgreSQL.
|
740
|
+
*Mehmet Emin İNAÇ*
|
882
741
|
|
883
|
-
|
742
|
+
* Update payload names for `sql.active_record` instrumentation to be
|
743
|
+
more descriptive.
|
884
744
|
|
885
|
-
Fixes #
|
745
|
+
Fixes #30586.
|
886
746
|
|
887
|
-
*
|
888
|
-
passed as a lambda with an arity of one.
|
747
|
+
*Jeremy Green*
|
889
748
|
|
890
|
-
|
749
|
+
* Add new error class `LockWaitTimeout` which will be raised
|
750
|
+
when lock wait timeout exceeded.
|
891
751
|
|
892
|
-
*
|
752
|
+
*Gabriel Courtemanche*
|
893
753
|
|
894
|
-
*
|
754
|
+
* Remove deprecated `#migration_keys`.
|
895
755
|
|
896
|
-
|
756
|
+
*Ryuta Kamizono*
|
897
757
|
|
898
|
-
|
758
|
+
* Automatically guess the inverse associations for STI.
|
899
759
|
|
900
|
-
*
|
901
|
-
`after_rollback`/`after_create` callbacks and prints them to the logs.
|
902
|
-
Future versions of Rails will not rescue these errors anymore and
|
903
|
-
just bubble them up like the other callbacks.
|
760
|
+
*Yuichiro Kaneko*
|
904
761
|
|
905
|
-
|
762
|
+
* Ensure `sum` honors `distinct` on `has_many :through` associations.
|
906
763
|
|
907
|
-
|
764
|
+
Fixes #16791.
|
908
765
|
|
909
|
-
|
910
|
-
config.active_record.raise_in_transactional_callbacks = true
|
766
|
+
*Aaron Wortham*
|
911
767
|
|
912
|
-
|
768
|
+
* Add `binary` fixture helper method.
|
913
769
|
|
914
|
-
*
|
770
|
+
*Atsushi Yoshida*
|
915
771
|
|
916
|
-
*
|
917
|
-
`enum`) with the same name as a global method are incorrectly overridden
|
918
|
-
when subclassing.
|
772
|
+
* When using `Relation#or`, extract the common conditions and put them before the OR condition.
|
919
773
|
|
920
|
-
|
774
|
+
*Maxime Handfield Lapointe*
|
921
775
|
|
922
|
-
|
776
|
+
* `Relation#or` now accepts two relations who have different values for
|
777
|
+
`references` only, as `references` can be implicitly called by `where`.
|
923
778
|
|
924
|
-
|
925
|
-
well.
|
779
|
+
Fixes #29411.
|
926
780
|
|
927
781
|
*Sean Griffin*
|
928
782
|
|
929
|
-
*
|
930
|
-
|
931
|
-
Fixes #16425.
|
783
|
+
* `ApplicationRecord` is no longer generated when generating models. If you
|
784
|
+
need to generate it, it can be created with `rails g application_record`.
|
932
785
|
|
933
|
-
*
|
786
|
+
*Lisa Ugray*
|
934
787
|
|
935
|
-
*
|
788
|
+
* Fix `COUNT(DISTINCT ...)` with `ORDER BY` and `LIMIT` to keep the existing select list.
|
936
789
|
|
937
|
-
|
938
|
-
|
939
|
-
*Sergey Potapov*
|
790
|
+
*Ryuta Kamizono*
|
940
791
|
|
941
|
-
*
|
792
|
+
* When a `has_one` association is destroyed by `dependent: destroy`,
|
793
|
+
`destroyed_by_association` will now be set to the reflection, matching the
|
794
|
+
behaviour of `has_many` associations.
|
942
795
|
|
943
|
-
|
796
|
+
*Lisa Ugray*
|
944
797
|
|
945
|
-
|
798
|
+
* Fix `unscoped(where: [columns])` removing the wrong bind values.
|
946
799
|
|
947
|
-
|
948
|
-
|
949
|
-
index_exists? :articles, :body, name: "idx_title" # => `true`
|
800
|
+
When the `where` is called on a relation after a `or`, unscoping the column of that later `where` removed
|
801
|
+
bind values used by the `or` instead. (possibly other cases too)
|
950
802
|
|
951
|
-
|
952
|
-
|
953
|
-
|
803
|
+
```
|
804
|
+
Post.where(id: 1).or(Post.where(id: 2)).where(foo: 3).unscope(where: :foo).to_sql
|
805
|
+
# Currently:
|
806
|
+
# SELECT "posts".* FROM "posts" WHERE ("posts"."id" = 2 OR "posts"."id" = 3)
|
807
|
+
# With fix:
|
808
|
+
# SELECT "posts".* FROM "posts" WHERE ("posts"."id" = 1 OR "posts"."id" = 2)
|
809
|
+
```
|
954
810
|
|
955
|
-
*
|
811
|
+
*Maxime Handfield Lapointe*
|
956
812
|
|
957
|
-
*
|
958
|
-
|
959
|
-
With Rails 5 this will change to `null: false`.
|
813
|
+
* Values constructed using multi-parameter assignment will now use the
|
814
|
+
post-type-cast value for rendering in single-field form inputs.
|
960
815
|
|
961
816
|
*Sean Griffin*
|
962
817
|
|
963
|
-
*
|
964
|
-
|
965
|
-
destroyed.
|
966
|
-
|
967
|
-
*Lachlan Sylvester*
|
968
|
-
|
969
|
-
* Define `id_was` to get the previous value of the primary key.
|
970
|
-
|
971
|
-
Currently when we call `id_was` and we have a custom primary key name,
|
972
|
-
Active Record will return the current value of the primary key. This
|
973
|
-
makes it impossible to correctly do an update operation if you change the
|
974
|
-
id.
|
975
|
-
|
976
|
-
Fixes #16413.
|
977
|
-
|
978
|
-
*Rafael Mendonça França*
|
979
|
-
|
980
|
-
* Deprecate `DatabaseTasks.load_schema` to act on the current connection.
|
981
|
-
Use `.load_schema_current` instead. In the future `load_schema` will
|
982
|
-
require the `configuration` to act on as an argument.
|
983
|
-
|
984
|
-
*Yves Senn*
|
985
|
-
|
986
|
-
* Fix automatic maintaining test schema to properly handle sql structure
|
987
|
-
schema format.
|
988
|
-
|
989
|
-
Fixes #15394.
|
990
|
-
|
991
|
-
*Wojciech Wnętrzak*
|
992
|
-
|
993
|
-
* Fix type casting to Decimal from Float with large precision.
|
994
|
-
|
995
|
-
*Tomohiro Hashidate*
|
818
|
+
* `Relation#joins` is no longer affected by the target model's
|
819
|
+
`current_scope`, with the exception of `unscoped`.
|
996
820
|
|
997
|
-
|
821
|
+
Fixes #29338.
|
998
822
|
|
999
|
-
|
1000
|
-
source so it has been deprecated. Code that used `source_macro`
|
1001
|
-
was removed in #16353.
|
823
|
+
*Sean Griffin*
|
1002
824
|
|
1003
|
-
|
825
|
+
* Change sqlite3 boolean serialization to use 1 and 0.
|
1004
826
|
|
1005
|
-
|
827
|
+
SQLite natively recognizes 1 and 0 as true and false, but does not natively
|
828
|
+
recognize 't' and 'f' as was previously serialized.
|
1006
829
|
|
1007
|
-
|
830
|
+
This change in serialization requires a migration of stored boolean data
|
831
|
+
for SQLite databases, so it's implemented behind a configuration flag
|
832
|
+
whose default false value is deprecated.
|
1008
833
|
|
1009
|
-
*
|
834
|
+
*Lisa Ugray*
|
1010
835
|
|
1011
|
-
*
|
836
|
+
* Skip query caching when working with batches of records (`find_each`, `find_in_batches`,
|
837
|
+
`in_batches`).
|
1012
838
|
|
1013
|
-
|
839
|
+
Previously, records would be fetched in batches, but all records would be retained in memory
|
840
|
+
until the end of the request or job.
|
1014
841
|
|
1015
|
-
|
1016
|
-
t.jsonb :meta_data
|
1017
|
-
end
|
842
|
+
*Eugene Kenny*
|
1018
843
|
|
1019
|
-
|
844
|
+
* Prevent errors raised by `sql.active_record` notification subscribers from being converted into
|
845
|
+
`ActiveRecord::StatementInvalid` exceptions.
|
1020
846
|
|
1021
|
-
*
|
847
|
+
*Dennis Taylor*
|
1022
848
|
|
1023
|
-
|
849
|
+
* Fix eager loading/preloading association with scope including joins.
|
1024
850
|
|
1025
|
-
|
1026
|
-
`DROP DEFAULT` instead of a `DEFAULT NULL` query.
|
851
|
+
Fixes #28324.
|
1027
852
|
|
1028
|
-
|
853
|
+
*Ryuta Kamizono*
|
1029
854
|
|
1030
|
-
|
855
|
+
* Fix transactions to apply state to child transactions.
|
1031
856
|
|
1032
|
-
|
1033
|
-
|
857
|
+
Previously, if you had a nested transaction and the outer transaction was rolledback, the record from the
|
858
|
+
inner transaction would still be marked as persisted.
|
1034
859
|
|
1035
|
-
|
860
|
+
This change fixes that by applying the state of the parent transaction to the child transaction when the
|
861
|
+
parent transaction is rolledback. This will correctly mark records from the inner transaction as not persisted.
|
1036
862
|
|
1037
|
-
|
1038
|
-
t.references :station, type: :uuid
|
1039
|
-
end
|
863
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
1040
864
|
|
1041
|
-
|
865
|
+
* Deprecate `set_state` method in `TransactionState`.
|
1042
866
|
|
1043
|
-
|
1044
|
-
|
867
|
+
Deprecated the `set_state` method in favor of setting the state via specific methods. If you need to mark the
|
868
|
+
state of the transaction you can now use `rollback!`, `commit!` or `nullify!` instead of
|
869
|
+
`set_state(:rolledback)`, `set_state(:committed)`, or `set_state(nil)`.
|
1045
870
|
|
1046
|
-
|
871
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
1047
872
|
|
1048
|
-
|
873
|
+
* Deprecate delegating to `arel` in `Relation`.
|
1049
874
|
|
1050
|
-
*
|
1051
|
-
a class.
|
875
|
+
*Ryuta Kamizono*
|
1052
876
|
|
1053
|
-
|
877
|
+
* Query cache was unavailable when entering the `ActiveRecord::Base.cache` block
|
878
|
+
without being connected.
|
1054
879
|
|
1055
|
-
*
|
880
|
+
*Tsukasa Oishi*
|
1056
881
|
|
1057
|
-
|
882
|
+
* Previously, when building records using a `has_many :through` association,
|
883
|
+
if the child records were deleted before the parent was saved, they would
|
884
|
+
still be persisted. Now, if child records are deleted before the parent is saved
|
885
|
+
on a `has_many :through` association, the child records will not be persisted.
|
1058
886
|
|
1059
|
-
*
|
887
|
+
*Tobias Kraze*
|
1060
888
|
|
1061
|
-
|
1062
|
-
the
|
889
|
+
* Merging two relations representing nested joins no longer transforms the joins of
|
890
|
+
the merged relation into LEFT OUTER JOIN.
|
1063
891
|
|
1064
892
|
Example:
|
1065
893
|
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
class Comment
|
1071
|
-
include ActiveModel::Model
|
1072
|
-
attr_accessor :category, :text
|
1073
|
-
end
|
1074
|
-
|
1075
|
-
post = Post.create!
|
1076
|
-
post.comment = Comment.new(category: "Animals", text: "This is a comment about squirrels.")
|
1077
|
-
post.save!
|
1078
|
-
|
1079
|
-
# 4.0
|
1080
|
-
post.comment # => {"category"=>"Animals", "text"=>"This is a comment about squirrels."}
|
1081
|
-
|
1082
|
-
# 4.1 before
|
1083
|
-
post.comment # => "#<Comment:0x007f80ab48ff98>"
|
1084
|
-
|
1085
|
-
# 4.1 after
|
1086
|
-
post.comment # => {"category"=>"Animals", "text"=>"This is a comment about squirrels."}
|
1087
|
-
|
1088
|
-
When using `JSON` as the coder in `serialize`, Active Record will use the
|
1089
|
-
new `ActiveRecord::Coders::JSON` coder which delegates its `dump/load` to
|
1090
|
-
`ActiveSupport::JSON.encode/decode`. This ensures special objects are dumped
|
1091
|
-
correctly using the `#as_json` hook.
|
1092
|
-
|
1093
|
-
To keep the previous behaviour, supply a custom coder instead
|
1094
|
-
([example](https://gist.github.com/jenncoop/8c4142bbe59da77daa63)).
|
1095
|
-
|
1096
|
-
Fixes #15594.
|
1097
|
-
|
1098
|
-
*Jenn Cooper*
|
1099
|
-
|
1100
|
-
* Do not use `RENAME INDEX` syntax for MariaDB 10.0.
|
1101
|
-
|
1102
|
-
Fixes #15931.
|
1103
|
-
|
1104
|
-
*Jeff Browning*
|
1105
|
-
|
1106
|
-
* Calling `#empty?` on a `has_many` association would use the value from the
|
1107
|
-
counter cache if one exists.
|
1108
|
-
|
1109
|
-
*David Verhasselt*
|
1110
|
-
|
1111
|
-
* Fix the schema dump generated for tables without constraints and with
|
1112
|
-
primary key with default value of custom PostgreSQL function result.
|
1113
|
-
|
1114
|
-
Fixes #16111.
|
894
|
+
```
|
895
|
+
Author.joins(:posts).merge(Post.joins(:comments))
|
896
|
+
# Before the change:
|
897
|
+
#=> SELECT ... FROM authors INNER JOIN posts ON ... LEFT OUTER JOIN comments ON...
|
1115
898
|
|
1116
|
-
|
899
|
+
# After the change:
|
900
|
+
#=> SELECT ... FROM authors INNER JOIN posts ON ... INNER JOIN comments ON...
|
901
|
+
```
|
1117
902
|
|
1118
|
-
*
|
1119
|
-
produce an `IN` statements.
|
903
|
+
*Maxime Handfield Lapointe*
|
1120
904
|
|
1121
|
-
|
1122
|
-
|
1123
|
-
UPDATE "categorizations" SET "category_id" = NULL WHERE
|
1124
|
-
"categorizations"."category_id" = 1 AND "categorizations"."id" IN (1, 2)
|
1125
|
-
|
1126
|
-
After:
|
905
|
+
* `ActiveRecord::Persistence#touch` does not work well when optimistic locking enabled and
|
906
|
+
`locking_column`, without default value, is null in the database.
|
1127
907
|
|
1128
|
-
|
1129
|
-
"categorizations"."category_id" = 1
|
908
|
+
*bogdanvlviv*
|
1130
909
|
|
1131
|
-
|
910
|
+
* Fix destroying existing object does not work well when optimistic locking enabled and
|
911
|
+
`locking_column` is null in the database.
|
1132
912
|
|
1133
|
-
*
|
1134
|
-
values for string columns. Otherwise, in some database, the string column
|
1135
|
-
values will be coerced to a numeric allowing false or 0.seconds match any
|
1136
|
-
string starting with a non-digit.
|
913
|
+
*bogdanvlviv*
|
1137
914
|
|
1138
|
-
|
1139
|
-
|
1140
|
-
App.where(apikey: false) # => SELECT * FROM users WHERE apikey = '0'
|
915
|
+
* Use bulk INSERT to insert fixtures for better performance.
|
1141
916
|
|
1142
|
-
*
|
917
|
+
*Kir Shatrov*
|
1143
918
|
|
1144
|
-
*
|
1145
|
-
API for presence validations on associations.
|
919
|
+
* Prevent creation of bind param if casted value is nil.
|
1146
920
|
|
1147
|
-
*
|
921
|
+
*Ryuta Kamizono*
|
1148
922
|
|
1149
|
-
*
|
1150
|
-
(Call to `count` generated invalid SQL.)
|
923
|
+
* Deprecate passing arguments and block at the same time to `count` and `sum` in `ActiveRecord::Calculations`.
|
1151
924
|
|
1152
|
-
*
|
925
|
+
*Ryuta Kamizono*
|
1153
926
|
|
1154
|
-
*
|
927
|
+
* Loading model schema from database is now thread-safe.
|
1155
928
|
|
1156
|
-
Fixes #
|
929
|
+
Fixes #28589.
|
1157
930
|
|
1158
|
-
*
|
931
|
+
*Vikrant Chaudhary*, *David Abdemoulaie*
|
1159
932
|
|
1160
|
-
*
|
933
|
+
* Add `ActiveRecord::Base#cache_version` to support recyclable cache keys via the new versioned entries
|
934
|
+
in `ActiveSupport::Cache`. This also means that `ActiveRecord::Base#cache_key` will now return a stable key
|
935
|
+
that does not include a timestamp any more.
|
1161
936
|
|
1162
|
-
|
937
|
+
NOTE: This feature is turned off by default, and `#cache_key` will still return cache keys with timestamps
|
938
|
+
until you set `ActiveRecord::Base.cache_versioning = true`. That's the setting for all new apps on Rails 5.2+
|
1163
939
|
|
1164
|
-
*
|
1165
|
-
from `before_destroy` to `after_destroy` callback chain
|
940
|
+
*DHH*
|
1166
941
|
|
1167
|
-
|
942
|
+
* Respect `SchemaDumper.ignore_tables` in rake tasks for databases structure dump.
|
1168
943
|
|
1169
|
-
*
|
944
|
+
*Rusty Geldmacher*, *Guillermo Iguaran*
|
1170
945
|
|
1171
|
-
*
|
946
|
+
* Add type caster to `RuntimeReflection#alias_name`.
|
1172
947
|
|
1173
|
-
|
1174
|
-
changed in order for it to be persisted in the database. Now it is no longer
|
1175
|
-
required.
|
948
|
+
Fixes #28959.
|
1176
949
|
|
1177
|
-
|
950
|
+
*Jon Moss*
|
1178
951
|
|
1179
|
-
|
1180
|
-
user.name << ' Griffin'
|
1181
|
-
user.name_will_change!
|
1182
|
-
user.save
|
1183
|
-
user.reload.name # => "Sean Griffin"
|
952
|
+
* Deprecate `supports_statement_cache?`.
|
1184
953
|
|
1185
|
-
|
954
|
+
*Ryuta Kamizono*
|
1186
955
|
|
1187
|
-
|
1188
|
-
|
1189
|
-
user.save
|
1190
|
-
user.reload.name # => "Sean Griffin"
|
956
|
+
* Raise error `UnknownMigrationVersionError` on the movement of migrations
|
957
|
+
when the current migration does not exist.
|
1191
958
|
|
1192
|
-
*
|
959
|
+
*bogdanvlviv*
|
1193
960
|
|
1194
|
-
*
|
1195
|
-
is invalid.
|
961
|
+
* Fix `bin/rails db:forward` first migration.
|
1196
962
|
|
1197
|
-
*
|
963
|
+
*bogdanvlviv*
|
1198
964
|
|
1199
|
-
* Support
|
1200
|
-
a part of `schema.rb`. This is supported by Mysql2Adapter, MysqlAdapter
|
1201
|
-
and PostgreSQLAdapter.
|
965
|
+
* Support Descending Indexes for MySQL.
|
1202
966
|
|
1203
|
-
|
1204
|
-
|
967
|
+
MySQL 8.0.1 and higher supports descending indexes: `DESC` in an index definition is no longer ignored.
|
968
|
+
See https://dev.mysql.com/doc/refman/8.0/en/descending-indexes.html.
|
1205
969
|
|
1206
|
-
|
970
|
+
*Ryuta Kamizono*
|
1207
971
|
|
1208
|
-
|
1209
|
-
add_foreign_key :articles, :authors
|
1210
|
-
remove_foreign_key :articles, :authors
|
972
|
+
* Fix inconsistency with changed attributes when overriding Active Record attribute reader.
|
1211
973
|
|
1212
|
-
*
|
974
|
+
*bogdanvlviv*
|
1213
975
|
|
1214
|
-
*
|
1215
|
-
|
976
|
+
* When calling the dynamic fixture accessor method with no arguments, it now returns all fixtures of this type.
|
977
|
+
Previously this method always returned an empty array.
|
1216
978
|
|
1217
|
-
*
|
1218
|
-
|
1219
|
-
* Deprecate automatic counter caches on `has_many :through`. The behavior was
|
1220
|
-
broken and inconsistent.
|
1221
|
-
|
1222
|
-
*Sean Griffin*
|
1223
|
-
|
1224
|
-
* `preload` preserves readonly flag for associations.
|
1225
|
-
|
1226
|
-
See #15853.
|
1227
|
-
|
1228
|
-
*Yves Senn*
|
1229
|
-
|
1230
|
-
* Assume numeric types have changed if they were assigned to a value that
|
1231
|
-
would fail numericality validation, regardless of the old value. Previously
|
1232
|
-
this would only occur if the old value was 0.
|
1233
|
-
|
1234
|
-
Example:
|
1235
|
-
|
1236
|
-
model = Model.create!(number: 5)
|
1237
|
-
model.number = '5wibble'
|
1238
|
-
model.number_changed? # => true
|
1239
|
-
|
1240
|
-
Fixes #14731.
|
1241
|
-
|
1242
|
-
*Sean Griffin*
|
1243
|
-
|
1244
|
-
* `reload` no longer merges with the existing attributes.
|
1245
|
-
The attribute hash is fully replaced. The record is put into the same state
|
1246
|
-
as it would be with `Model.find(model.id)`.
|
1247
|
-
|
1248
|
-
*Sean Griffin*
|
1249
|
-
|
1250
|
-
* The object returned from `select_all` must respond to `column_types`.
|
1251
|
-
If this is not the case a `NoMethodError` is raised.
|
1252
|
-
|
1253
|
-
*Sean Griffin*
|
1254
|
-
|
1255
|
-
* Detect in-place modifications of PG array types
|
1256
|
-
|
1257
|
-
*Sean Griffin*
|
1258
|
-
|
1259
|
-
* Add `bin/rake db:purge` task to empty the current database.
|
1260
|
-
|
1261
|
-
*Yves Senn*
|
1262
|
-
|
1263
|
-
* Deprecate `serialized_attributes` without replacement.
|
1264
|
-
|
1265
|
-
*Sean Griffin*
|
1266
|
-
|
1267
|
-
* Correctly extract IPv6 addresses from `DATABASE_URI`: the square brackets
|
1268
|
-
are part of the URI structure, not the actual host.
|
1269
|
-
|
1270
|
-
Fixes #15705.
|
1271
|
-
|
1272
|
-
*Andy Bakun*, *Aaron Stone*
|
1273
|
-
|
1274
|
-
* Ensure both parent IDs are set on join records when both sides of a
|
1275
|
-
through association are new.
|
1276
|
-
|
1277
|
-
*Sean Griffin*
|
1278
|
-
|
1279
|
-
* `ActiveRecord::Dirty` now detects in-place changes to mutable values.
|
1280
|
-
Serialized attributes on ActiveRecord models will no longer save when
|
1281
|
-
unchanged.
|
1282
|
-
|
1283
|
-
Fixes #8328.
|
1284
|
-
|
1285
|
-
*Sean Griffin*
|
1286
|
-
|
1287
|
-
* `Pluck` now works when selecting columns from different tables with the same
|
1288
|
-
name.
|
1289
|
-
|
1290
|
-
Fixes #15649.
|
1291
|
-
|
1292
|
-
*Sean Griffin*
|
1293
|
-
|
1294
|
-
* Remove `cache_attributes` and friends. All attributes are cached.
|
1295
|
-
|
1296
|
-
*Sean Griffin*
|
1297
|
-
|
1298
|
-
* Remove deprecated method `ActiveRecord::Base.quoted_locking_column`.
|
1299
|
-
|
1300
|
-
*Akshay Vishnoi*
|
1301
|
-
|
1302
|
-
* `ActiveRecord::FinderMethods.find` with block can handle proc parameter as
|
1303
|
-
`Enumerable#find` does.
|
1304
|
-
|
1305
|
-
Fixes #15382.
|
1306
|
-
|
1307
|
-
*James Yang*
|
1308
|
-
|
1309
|
-
* Make timezone aware attributes work with PostgreSQL array columns.
|
1310
|
-
|
1311
|
-
Fixes #13402.
|
1312
|
-
|
1313
|
-
*Kuldeep Aggarwal*, *Sean Griffin*
|
1314
|
-
|
1315
|
-
* `ActiveRecord::SchemaMigration` has no primary key regardless of the
|
1316
|
-
`primary_key_prefix_type` configuration.
|
1317
|
-
|
1318
|
-
Fixes #15051.
|
1319
|
-
|
1320
|
-
*JoseLuis Torres*, *Yves Senn*
|
1321
|
-
|
1322
|
-
* `rake db:migrate:status` works with legacy migration numbers like `00018_xyz.rb`.
|
1323
|
-
|
1324
|
-
Fixes #15538.
|
1325
|
-
|
1326
|
-
*Yves Senn*
|
1327
|
-
|
1328
|
-
* Baseclass becomes! subclass.
|
1329
|
-
|
1330
|
-
Before this change, a record which changed its STI type, could not be
|
1331
|
-
updated.
|
1332
|
-
|
1333
|
-
Fixes #14785.
|
1334
|
-
|
1335
|
-
*Matthew Draper*, *Earl St Sauver*, *Edo Balvers*
|
1336
|
-
|
1337
|
-
* Remove deprecated `ActiveRecord::Migrator.proper_table_name`. Use the
|
1338
|
-
`proper_table_name` instance method on `ActiveRecord::Migration` instead.
|
1339
|
-
|
1340
|
-
*Akshay Vishnoi*
|
1341
|
-
|
1342
|
-
* Fix regression on eager loading association based on SQL query rather than
|
1343
|
-
existing column.
|
1344
|
-
|
1345
|
-
Fixes #15480.
|
1346
|
-
|
1347
|
-
*Lauro Caetano*, *Carlos Antonio da Silva*
|
1348
|
-
|
1349
|
-
* Deprecate returning `nil` from `column_for_attribute` when no column exists.
|
1350
|
-
It will return a null object in Rails 5.0
|
1351
|
-
|
1352
|
-
*Sean Griffin*
|
1353
|
-
|
1354
|
-
* Implemented `ActiveRecord::Base#pretty_print` to work with PP.
|
1355
|
-
|
1356
|
-
*Ethan*
|
1357
|
-
|
1358
|
-
* Preserve type when dumping PostgreSQL point, bit, bit varying and money
|
1359
|
-
columns.
|
1360
|
-
|
1361
|
-
*Yves Senn*
|
1362
|
-
|
1363
|
-
* New records remain new after YAML serialization.
|
1364
|
-
|
1365
|
-
*Sean Griffin*
|
1366
|
-
|
1367
|
-
* PostgreSQL support default values for enum types. Fixes #7814.
|
1368
|
-
|
1369
|
-
*Yves Senn*
|
1370
|
-
|
1371
|
-
* PostgreSQL `default_sequence_name` respects schema. Fixes #7516.
|
1372
|
-
|
1373
|
-
*Yves Senn*
|
1374
|
-
|
1375
|
-
* Fix `columns_for_distinct` of PostgreSQL adapter to work correctly
|
1376
|
-
with orders without sort direction modifiers.
|
1377
|
-
|
1378
|
-
*Nikolay Kondratyev*
|
1379
|
-
|
1380
|
-
* PostgreSQL `reset_pk_sequence!` respects schemas. Fixes #14719.
|
1381
|
-
|
1382
|
-
*Yves Senn*
|
1383
|
-
|
1384
|
-
* Keep PostgreSQL `hstore` and `json` attributes as `Hash` in `@attributes`.
|
1385
|
-
Fixes duplication in combination with `store_accessor`.
|
1386
|
-
|
1387
|
-
Fixes #15369.
|
1388
|
-
|
1389
|
-
*Yves Senn*
|
1390
|
-
|
1391
|
-
* `rake railties:install:migrations` respects the order of railties.
|
1392
|
-
|
1393
|
-
*Arun Agrawal*
|
1394
|
-
|
1395
|
-
* Fix redefine a `has_and_belongs_to_many` inside inherited class
|
1396
|
-
Fixing regression case, where redefining the same `has_and_belongs_to_many`
|
1397
|
-
definition into a subclass would raise.
|
1398
|
-
|
1399
|
-
Fixes #14983.
|
1400
|
-
|
1401
|
-
*arthurnn*
|
1402
|
-
|
1403
|
-
* Fix `has_and_belongs_to_many` public reflection.
|
1404
|
-
When defining a `has_and_belongs_to_many`, internally we convert that to two has_many.
|
1405
|
-
But as `reflections` is a public API, people expect to see the right macro.
|
1406
|
-
|
1407
|
-
Fixes #14682.
|
1408
|
-
|
1409
|
-
*arthurnn*
|
1410
|
-
|
1411
|
-
* Fix serialization for records with an attribute named `format`.
|
1412
|
-
|
1413
|
-
Fixes #15188.
|
1414
|
-
|
1415
|
-
*Godfrey Chan*
|
1416
|
-
|
1417
|
-
* When a `group` is set, `sum`, `size`, `average`, `minimum` and `maximum`
|
1418
|
-
on a NullRelation should return a Hash.
|
1419
|
-
|
1420
|
-
*Kuldeep Aggarwal*
|
1421
|
-
|
1422
|
-
* Fix serialized fields returning serialized data after being updated with
|
1423
|
-
`update_column`.
|
1424
|
-
|
1425
|
-
*Simon Hørup Eskildsen*
|
1426
|
-
|
1427
|
-
* Fix polymorphic eager loading when using a String as foreign key.
|
1428
|
-
|
1429
|
-
Fixes #14734.
|
1430
|
-
|
1431
|
-
*Lauro Caetano*
|
1432
|
-
|
1433
|
-
* Change belongs_to touch to be consistent with timestamp updates
|
1434
|
-
|
1435
|
-
If a model is set up with a belongs_to: touch relationship the parent
|
1436
|
-
record will only be touched if the record was modified. This makes it
|
1437
|
-
consistent with timestamp updating on the record itself.
|
1438
|
-
|
1439
|
-
*Brock Trappitt*
|
1440
|
-
|
1441
|
-
* Fix the inferred table name of a `has_and_belongs_to_many` auxiliary
|
1442
|
-
table inside a schema.
|
1443
|
-
|
1444
|
-
Fixes #14824.
|
1445
|
-
|
1446
|
-
*Eric Chahin*
|
1447
|
-
|
1448
|
-
* Remove unused `:timestamp` type. Transparently alias it to `:datetime`
|
1449
|
-
in all cases. Fixes inconsistencies when column types are sent outside of
|
1450
|
-
`ActiveRecord`, such as for XML Serialization.
|
1451
|
-
|
1452
|
-
*Sean Griffin*
|
1453
|
-
|
1454
|
-
* Fix bug that added `table_name_prefix` and `table_name_suffix` to
|
1455
|
-
extension names in PostgreSQL when migrating.
|
1456
|
-
|
1457
|
-
*Joao Carlos*
|
1458
|
-
|
1459
|
-
* The `:index` option in migrations, which previously was only available for
|
1460
|
-
`references`, now works with any column types.
|
1461
|
-
|
1462
|
-
*Marc Schütz*
|
1463
|
-
|
1464
|
-
* Add support for counter name to be passed as parameter on `CounterCache::ClassMethods#reset_counters`.
|
1465
|
-
|
1466
|
-
*jnormore*
|
1467
|
-
|
1468
|
-
* Restrict deletion of record when using `delete_all` with `uniq`, `group`, `having`
|
1469
|
-
or `offset`.
|
1470
|
-
|
1471
|
-
In these cases the generated query ignored them and that caused unintended
|
1472
|
-
records to be deleted.
|
1473
|
-
|
1474
|
-
Fixes #11985.
|
1475
|
-
|
1476
|
-
*Leandro Facchinetti*
|
1477
|
-
|
1478
|
-
* Floats with limit >= 25 that get turned into doubles in MySQL no longer have
|
1479
|
-
their limit dropped from the schema.
|
1480
|
-
|
1481
|
-
Fixes #14135.
|
1482
|
-
|
1483
|
-
*Aaron Nelson*
|
1484
|
-
|
1485
|
-
* Fix how to calculate associated class name when using namespaced `has_and_belongs_to_many`
|
1486
|
-
association.
|
1487
|
-
|
1488
|
-
Fixes #14709.
|
1489
|
-
|
1490
|
-
*Kassio Borges*
|
1491
|
-
|
1492
|
-
* `ActiveRecord::Relation::Merger#filter_binds` now compares equivalent symbols and
|
1493
|
-
strings in column names as equal.
|
1494
|
-
|
1495
|
-
This fixes a rare case in which more bind values are passed than there are
|
1496
|
-
placeholders for them in the generated SQL statement, which can make PostgreSQL
|
1497
|
-
throw a `StatementInvalid` exception.
|
1498
|
-
|
1499
|
-
*Nat Budin*
|
1500
|
-
|
1501
|
-
* Fix `stored_attributes` to correctly merge the details of stored
|
1502
|
-
attributes defined in parent classes.
|
1503
|
-
|
1504
|
-
Fixes #14672.
|
1505
|
-
|
1506
|
-
*Brad Bennett*, *Jessica Yao*, *Lakshmi Parthasarathy*
|
1507
|
-
|
1508
|
-
* `change_column_default` allows `[]` as argument to `change_column_default`.
|
1509
|
-
|
1510
|
-
Fixes #11586.
|
1511
|
-
|
1512
|
-
*Yves Senn*
|
1513
|
-
|
1514
|
-
* Handle `name` and `"char"` column types in the PostgreSQL adapter.
|
1515
|
-
|
1516
|
-
`name` and `"char"` are special character types used internally by
|
1517
|
-
PostgreSQL and are used by internal system catalogs. These field types
|
1518
|
-
can sometimes show up in structure-sniffing queries that feature internal system
|
1519
|
-
structures or with certain PostgreSQL extensions.
|
1520
|
-
|
1521
|
-
*J Smith*, *Yves Senn*
|
1522
|
-
|
1523
|
-
* Fix `PostgreSQLAdapter::OID::Float#type_cast` to convert Infinity and
|
1524
|
-
NaN PostgreSQL values into a native Ruby `Float::INFINITY` and `Float::NAN`
|
1525
|
-
|
1526
|
-
Before:
|
1527
|
-
|
1528
|
-
Point.create(value: 1.0/0)
|
1529
|
-
Point.last.value # => 0.0
|
1530
|
-
|
1531
|
-
After:
|
1532
|
-
|
1533
|
-
Point.create(value: 1.0/0)
|
1534
|
-
Point.last.value # => Infinity
|
1535
|
-
|
1536
|
-
*Innokenty Mikhailov*
|
1537
|
-
|
1538
|
-
* Allow the PostgreSQL adapter to handle bigserial primary key types again.
|
1539
|
-
|
1540
|
-
Fixes #10410.
|
1541
|
-
|
1542
|
-
*Patrick Robertson*
|
1543
|
-
|
1544
|
-
* Deprecate joining, eager loading and preloading of instance dependent
|
1545
|
-
associations without replacement. These operations happen before instances
|
1546
|
-
are created. The current behavior is unexpected and can result in broken
|
1547
|
-
behavior.
|
1548
|
-
|
1549
|
-
Fixes #15024.
|
1550
|
-
|
1551
|
-
*Yves Senn*
|
1552
|
-
|
1553
|
-
* Fix `has_and_belongs_to_many` CollectionAssociation size calculations.
|
1554
|
-
|
1555
|
-
`has_and_belongs_to_many` should fall back to using the normal CollectionAssociation's
|
1556
|
-
size calculation if the collection is not cached or loaded.
|
1557
|
-
|
1558
|
-
Fixes #14913, #14914.
|
1559
|
-
|
1560
|
-
*Fred Wu*
|
1561
|
-
|
1562
|
-
* Return a non zero status when running `rake db:migrate:status` and migration table does
|
1563
|
-
not exist.
|
1564
|
-
|
1565
|
-
*Paul B.*
|
1566
|
-
|
1567
|
-
* Add support for module-level `table_name_suffix` in models.
|
1568
|
-
|
1569
|
-
This makes `table_name_suffix` work the same way as `table_name_prefix` when
|
1570
|
-
using namespaced models.
|
1571
|
-
|
1572
|
-
*Jenner LaFave*
|
1573
|
-
|
1574
|
-
* Revert the behaviour of `ActiveRecord::Relation#join` changed through 4.0 => 4.1 to 4.0.
|
1575
|
-
|
1576
|
-
In 4.1.0 `Relation#join` is delegated to `Arel#SelectManager`.
|
1577
|
-
In 4.0 series it is delegated to `Array#join`.
|
1578
|
-
|
1579
|
-
*Bogdan Gusiev*
|
1580
|
-
|
1581
|
-
* Log nil binary column values correctly.
|
1582
|
-
|
1583
|
-
When an object with a binary column is updated with a nil value
|
1584
|
-
in that column, the SQL logger would throw an exception when trying
|
1585
|
-
to log that nil value. This only occurs when updating a record
|
1586
|
-
that already has a non-nil value in that column since an initial nil
|
1587
|
-
value isn't included in the SQL anyway (at least, when dirty checking
|
1588
|
-
is enabled.) The column's new value will now be logged as `<NULL binary data>`
|
1589
|
-
to parallel the existing `<N bytes of binary data>` for non-nil values.
|
1590
|
-
|
1591
|
-
*James Coleman*
|
1592
|
-
|
1593
|
-
* Rails will now pass a custom validation context through to autosave associations
|
1594
|
-
in order to validate child associations with the same context.
|
1595
|
-
|
1596
|
-
Fixes #13854.
|
1597
|
-
|
1598
|
-
*Eric Chahin*, *Aaron Nelson*, *Kevin Casey*
|
1599
|
-
|
1600
|
-
* Stringify all variables keys of MySQL connection configuration.
|
1601
|
-
|
1602
|
-
When `sql_mode` variable for MySQL adapters set in configuration as `String`
|
1603
|
-
was ignored and overwritten by strict mode option.
|
1604
|
-
|
1605
|
-
Fixes #14895.
|
1606
|
-
|
1607
|
-
*Paul Nikitochkin*
|
1608
|
-
|
1609
|
-
* Ensure SQLite3 statements are closed on errors.
|
1610
|
-
|
1611
|
-
Fixes #13631.
|
1612
|
-
|
1613
|
-
*Timur Alperovich*
|
1614
|
-
|
1615
|
-
* Give `ActiveRecord::PredicateBuilder` private methods the privacy they deserve.
|
1616
|
-
|
1617
|
-
*Hector Satre*
|
1618
|
-
|
1619
|
-
* When using a custom `join_table` name on a `habtm`, rails was not saving it
|
1620
|
-
on Reflections. This causes a problem when rails loads fixtures, because it
|
1621
|
-
uses the reflections to set database with fixtures.
|
1622
|
-
|
1623
|
-
Fixes #14845.
|
1624
|
-
|
1625
|
-
*Kassio Borges*
|
1626
|
-
|
1627
|
-
* Reset the cache when modifying a Relation with cached Arel.
|
1628
|
-
Additionally display a warning message to make the user aware.
|
1629
|
-
|
1630
|
-
*Yves Senn*
|
1631
|
-
|
1632
|
-
* PostgreSQL should internally use `:datetime` consistently for TimeStamp. Assures
|
1633
|
-
different spellings of timestamps are treated the same.
|
1634
|
-
|
1635
|
-
Example:
|
1636
|
-
|
1637
|
-
mytimestamp.simplified_type('timestamp without time zone')
|
1638
|
-
# => :datetime
|
1639
|
-
mytimestamp.simplified_type('timestamp(6) without time zone')
|
1640
|
-
# => also :datetime (previously would be :timestamp)
|
1641
|
-
|
1642
|
-
See #14513.
|
1643
|
-
|
1644
|
-
*Jefferson Lai*
|
1645
|
-
|
1646
|
-
* `ActiveRecord::Base.no_touching` no longer triggers callbacks or start empty transactions.
|
1647
|
-
|
1648
|
-
Fixes #14841.
|
1649
|
-
|
1650
|
-
*Lucas Mazza*
|
1651
|
-
|
1652
|
-
* Fix name collision with `Array#select!` with `Relation#select!`.
|
1653
|
-
|
1654
|
-
Fixes #14752.
|
1655
|
-
|
1656
|
-
*Earl St Sauver*
|
1657
|
-
|
1658
|
-
* Fix unexpected behavior for `has_many :through` associations going through
|
1659
|
-
a scoped `has_many`.
|
1660
|
-
|
1661
|
-
If a `has_many` association is adjusted using a scope, and another
|
1662
|
-
`has_many :through` uses this association, then the scope adjustment is
|
1663
|
-
unexpectedly neglected.
|
1664
|
-
|
1665
|
-
Fixes #14537.
|
1666
|
-
|
1667
|
-
*Jan Habermann*
|
1668
|
-
|
1669
|
-
* `@destroyed` should always be set to `false` when an object is duped.
|
1670
|
-
|
1671
|
-
*Kuldeep Aggarwal*
|
1672
|
-
|
1673
|
-
* Enable `has_many` associations to support irregular inflections.
|
1674
|
-
|
1675
|
-
Fixes #8928.
|
1676
|
-
|
1677
|
-
*arthurnn*, *Javier Goizueta*
|
1678
|
-
|
1679
|
-
* Fix `count` used with a grouping not returning a Hash.
|
1680
|
-
|
1681
|
-
Fixes #14721.
|
1682
|
-
|
1683
|
-
*Eric Chahin*
|
1684
|
-
|
1685
|
-
* `sanitize_sql_like` helper method to escape a string for safe use in an SQL
|
1686
|
-
LIKE statement.
|
1687
|
-
|
1688
|
-
Example:
|
1689
|
-
|
1690
|
-
class Article
|
1691
|
-
def self.search(term)
|
1692
|
-
where("title LIKE ?", sanitize_sql_like(term))
|
1693
|
-
end
|
1694
|
-
end
|
1695
|
-
|
1696
|
-
Article.search("20% _reduction_")
|
1697
|
-
# => Query looks like "... title LIKE '20\% \_reduction\_' ..."
|
1698
|
-
|
1699
|
-
*Rob Gilson*, *Yves Senn*
|
1700
|
-
|
1701
|
-
* Do not quote uuid default value on `change_column`.
|
1702
|
-
|
1703
|
-
Fixes #14604.
|
1704
|
-
|
1705
|
-
*Eric Chahin*
|
1706
|
-
|
1707
|
-
* The comparison between `Relation` and `CollectionProxy` should be consistent.
|
1708
|
-
|
1709
|
-
Example:
|
1710
|
-
|
1711
|
-
author.posts == Post.where(author_id: author.id)
|
1712
|
-
# => true
|
1713
|
-
Post.where(author_id: author.id) == author.posts
|
1714
|
-
# => true
|
1715
|
-
|
1716
|
-
Fixes #13506.
|
1717
|
-
|
1718
|
-
*Lauro Caetano*
|
1719
|
-
|
1720
|
-
* Calling `delete_all` on an unloaded `CollectionProxy` no longer
|
1721
|
-
generates an SQL statement containing each id of the collection:
|
1722
|
-
|
1723
|
-
Before:
|
1724
|
-
|
1725
|
-
DELETE FROM `model` WHERE `model`.`parent_id` = 1
|
1726
|
-
AND `model`.`id` IN (1, 2, 3...)
|
1727
|
-
|
1728
|
-
After:
|
1729
|
-
|
1730
|
-
DELETE FROM `model` WHERE `model`.`parent_id` = 1
|
1731
|
-
|
1732
|
-
*Eileen M. Uchitelle*, *Aaron Patterson*
|
1733
|
-
|
1734
|
-
* Fix invalid SQL when aggregate methods (`empty?`, `any?`, `count`) used
|
1735
|
-
with `select`.
|
1736
|
-
|
1737
|
-
Fixes #13648.
|
1738
|
-
|
1739
|
-
*Simon Woker*
|
1740
|
-
|
1741
|
-
* PostgreSQL adapter only warns once for every missing OID per connection.
|
1742
|
-
|
1743
|
-
Fixes #14275.
|
1744
|
-
|
1745
|
-
*Matthew Draper*, *Yves Senn*
|
1746
|
-
|
1747
|
-
* PostgreSQL adapter automatically reloads it's type map when encountering
|
1748
|
-
unknown OIDs.
|
1749
|
-
|
1750
|
-
Fixes #14678.
|
1751
|
-
|
1752
|
-
*Matthew Draper*, *Yves Senn*
|
1753
|
-
|
1754
|
-
* Fix insertion of records via `has_many :through` association with scope.
|
1755
|
-
|
1756
|
-
Fixes #3548.
|
1757
|
-
|
1758
|
-
*Ivan Antropov*
|
1759
|
-
|
1760
|
-
* Auto-generate stable fixture UUIDs on PostgreSQL.
|
1761
|
-
|
1762
|
-
Fixes #11524.
|
1763
|
-
|
1764
|
-
*Roderick van Domburg*
|
1765
|
-
|
1766
|
-
* Fix a problem where an enum would overwrite values of another enum with the
|
1767
|
-
same name in an unrelated class.
|
1768
|
-
|
1769
|
-
Fixes #14607.
|
1770
|
-
|
1771
|
-
*Evan Whalen*
|
1772
|
-
|
1773
|
-
* PostgreSQL and SQLite string columns no longer have a default limit of 255.
|
1774
|
-
|
1775
|
-
Fixes #13435, #9153.
|
1776
|
-
|
1777
|
-
*Vladimir Sazhin*, *Toms Mikoss*, *Yves Senn*
|
1778
|
-
|
1779
|
-
* Make possible to have an association called `records`.
|
1780
|
-
|
1781
|
-
Fixes #11645.
|
1782
|
-
|
1783
|
-
*prathamesh-sonpatki*
|
1784
|
-
|
1785
|
-
* `to_sql` on an association now matches the query that is actually executed, where it
|
1786
|
-
could previously have incorrectly accrued additional conditions (e.g. as a result of
|
1787
|
-
a previous query). `CollectionProxy` now always defers to the association scope's
|
1788
|
-
`arel` method so the (incorrect) inherited one should be entirely concealed.
|
1789
|
-
|
1790
|
-
Fixes #14003.
|
1791
|
-
|
1792
|
-
*Jefferson Lai*
|
1793
|
-
|
1794
|
-
* Block a few default Class methods as scope name.
|
1795
|
-
|
1796
|
-
For instance, this will raise:
|
1797
|
-
|
1798
|
-
scope :public, -> { where(status: 1) }
|
1799
|
-
|
1800
|
-
*arthurnn*
|
1801
|
-
|
1802
|
-
* Fix error when using `with_options` with lambda.
|
1803
|
-
|
1804
|
-
Fixes #9805.
|
1805
|
-
|
1806
|
-
*Lauro Caetano*
|
1807
|
-
|
1808
|
-
* Switch `sqlite3:///` URLs (which were temporarily
|
1809
|
-
deprecated in 4.1) from relative to absolute.
|
1810
|
-
|
1811
|
-
If you still want the previous interpretation, you should replace
|
1812
|
-
`sqlite3:///my/path` with `sqlite3:my/path`.
|
1813
|
-
|
1814
|
-
*Matthew Draper*
|
1815
|
-
|
1816
|
-
* Treat blank UUID values as `nil`.
|
1817
|
-
|
1818
|
-
Example:
|
1819
|
-
|
1820
|
-
Sample.new(uuid_field: '') #=> <Sample id: nil, uuid_field: nil>
|
1821
|
-
|
1822
|
-
*Dmitry Lavrov*
|
1823
|
-
|
1824
|
-
* Enable support for materialized views on PostgreSQL >= 9.3.
|
1825
|
-
|
1826
|
-
*Dave Lee*
|
1827
|
-
|
1828
|
-
* The PostgreSQL adapter supports custom domains. Fixes #14305.
|
1829
|
-
|
1830
|
-
*Yves Senn*
|
1831
|
-
|
1832
|
-
* PostgreSQL `Column#type` is now determined through the corresponding OID.
|
1833
|
-
The column types stay the same except for enum columns. They no longer have
|
1834
|
-
`nil` as type but `enum`.
|
1835
|
-
|
1836
|
-
See #7814.
|
1837
|
-
|
1838
|
-
*Yves Senn*
|
1839
|
-
|
1840
|
-
* Fix error when specifying a non-empty default value on a PostgreSQL array
|
1841
|
-
column.
|
1842
|
-
|
1843
|
-
Fixes #10613.
|
1844
|
-
|
1845
|
-
*Luke Steensen*
|
1846
|
-
|
1847
|
-
* Fix error where `.persisted?` throws SystemStackError for an unsaved model with a
|
1848
|
-
custom primary key that did not save due to validation error.
|
1849
|
-
|
1850
|
-
Fixes #14393.
|
1851
|
-
|
1852
|
-
*Chris Finne*
|
1853
|
-
|
1854
|
-
* Introduce `validate` as an alias for `valid?`.
|
1855
|
-
|
1856
|
-
This is more intuitive when you want to run validations but don't care about the return value.
|
1857
|
-
|
1858
|
-
*Henrik Nyh*
|
1859
|
-
|
1860
|
-
* Create indexes inline in CREATE TABLE for MySQL.
|
1861
|
-
|
1862
|
-
This is important, because adding an index on a temporary table after it has been created
|
1863
|
-
would commit the transaction.
|
1864
|
-
|
1865
|
-
It also allows creating and dropping indexed tables with fewer queries and fewer permissions
|
1866
|
-
required.
|
1867
|
-
|
1868
|
-
Example:
|
1869
|
-
|
1870
|
-
create_table :temp, temporary: true, as: "SELECT id, name, zip FROM a_really_complicated_query" do |t|
|
1871
|
-
t.index :zip
|
1872
|
-
end
|
1873
|
-
# => CREATE TEMPORARY TABLE temp (INDEX (zip)) AS SELECT id, name, zip FROM a_really_complicated_query
|
1874
|
-
|
1875
|
-
*Cody Cutrer*, *Steve Rice*, *Rafael Mendonça Franca*
|
1876
|
-
|
1877
|
-
* Use singular table name in generated migrations when
|
1878
|
-
`ActiveRecord::Base.pluralize_table_names` is `false`.
|
1879
|
-
|
1880
|
-
Fixes #13426.
|
1881
|
-
|
1882
|
-
*Kuldeep Aggarwal*
|
1883
|
-
|
1884
|
-
* `touch` accepts many attributes to be touched at once.
|
1885
|
-
|
1886
|
-
Example:
|
1887
|
-
|
1888
|
-
# touches :signed_at, :sealed_at, and :updated_at/on attributes.
|
1889
|
-
Photo.last.touch(:signed_at, :sealed_at)
|
1890
|
-
|
1891
|
-
*James Pinto*
|
1892
|
-
|
1893
|
-
* `rake db:structure:dump` only dumps schema information if the schema
|
1894
|
-
migration table exists.
|
1895
|
-
|
1896
|
-
Fixes #14217.
|
1897
|
-
|
1898
|
-
*Yves Senn*
|
1899
|
-
|
1900
|
-
* Reap connections that were checked out by now-dead threads, instead
|
1901
|
-
of waiting until they disconnect by themselves. Before this change,
|
1902
|
-
a suitably constructed series of short-lived threads could starve
|
1903
|
-
the connection pool, without ever having more than a couple alive at
|
1904
|
-
the same time.
|
1905
|
-
|
1906
|
-
*Matthew Draper*
|
1907
|
-
|
1908
|
-
* `pk_and_sequence_for` now ensures that only the pg_depend entries
|
1909
|
-
pointing to pg_class, and thus only sequence objects, are considered.
|
1910
|
-
|
1911
|
-
*Josh Williams*
|
1912
|
-
|
1913
|
-
* `where.not` adds `references` for `includes` like normal `where` calls do.
|
1914
|
-
|
1915
|
-
Fixes #14406.
|
1916
|
-
|
1917
|
-
*Yves Senn*
|
1918
|
-
|
1919
|
-
* Extend fixture `$LABEL` replacement to allow string interpolation.
|
1920
|
-
|
1921
|
-
Example:
|
1922
|
-
|
1923
|
-
martin:
|
1924
|
-
email: $LABEL@email.com
|
1925
|
-
|
1926
|
-
users(:martin).email # => martin@email.com
|
1927
|
-
|
1928
|
-
*Eric Steele*
|
1929
|
-
|
1930
|
-
* Add support for `Relation` be passed as parameter on `QueryCache#select_all`.
|
1931
|
-
|
1932
|
-
Fixes #14361.
|
1933
|
-
|
1934
|
-
*arthurnn*
|
1935
|
-
|
1936
|
-
* Passing an Active Record object to `find` or `exists?` is now deprecated.
|
1937
|
-
Call `.id` on the object first.
|
1938
|
-
|
1939
|
-
*Aaron Patterson*
|
1940
|
-
|
1941
|
-
* Only use BINARY for MySQL case sensitive uniqueness check when column
|
1942
|
-
has a case insensitive collation.
|
1943
|
-
|
1944
|
-
*Ryuta Kamizono*
|
1945
|
-
|
1946
|
-
* Support for MySQL 5.6 fractional seconds.
|
1947
|
-
|
1948
|
-
*arthurnn*, *Tatsuhiko Miyagawa*
|
1949
|
-
|
1950
|
-
* Support for PostgreSQL `citext` data type enabling case-insensitive
|
1951
|
-
`where` values without needing to wrap in UPPER/LOWER sql functions.
|
1952
|
-
|
1953
|
-
*Troy Kruthoff*, *Lachlan Sylvester*
|
1954
|
-
|
1955
|
-
* Only save has_one associations if record has changes.
|
1956
|
-
Previously after save related callbacks, such as `#after_commit`, were triggered when the has_one
|
1957
|
-
object did not get saved to the db.
|
1958
|
-
|
1959
|
-
*Alan Kennedy*
|
1960
|
-
|
1961
|
-
* Allow strings to specify the `#order` value.
|
1962
|
-
|
1963
|
-
Example:
|
1964
|
-
|
1965
|
-
Model.order(id: 'asc').to_sql == Model.order(id: :asc).to_sql
|
1966
|
-
|
1967
|
-
*Marcelo Casiraghi*, *Robin Dupret*
|
1968
|
-
|
1969
|
-
* Dynamically register PostgreSQL enum OIDs. This prevents "unknown OID"
|
1970
|
-
warnings on enum columns.
|
1971
|
-
|
1972
|
-
*Dieter Komendera*
|
1973
|
-
|
1974
|
-
* `includes` is able to detect the right preloading strategy when string
|
1975
|
-
joins are involved.
|
1976
|
-
|
1977
|
-
Fixes #14109.
|
1978
|
-
|
1979
|
-
*Aaron Patterson*, *Yves Senn*
|
1980
|
-
|
1981
|
-
* Fix error with validation with enum fields for records where the value for
|
1982
|
-
any enum attribute is always evaluated as 0 during uniqueness validation.
|
1983
|
-
|
1984
|
-
Fixes #14172.
|
1985
|
-
|
1986
|
-
*Vilius Luneckas* *Ahmed AbouElhamayed*
|
1987
|
-
|
1988
|
-
* `before_add` callbacks are fired before the record is saved on
|
1989
|
-
`has_and_belongs_to_many` associations *and* on `has_many :through`
|
1990
|
-
associations. Before this change, `before_add` callbacks would be fired
|
1991
|
-
before the record was saved on `has_and_belongs_to_many` associations, but
|
1992
|
-
*not* on `has_many :through` associations.
|
1993
|
-
|
1994
|
-
Fixes #14144.
|
1995
|
-
|
1996
|
-
* Fix STI classes not defining an attribute method if there is a conflicting
|
1997
|
-
private method defined on its ancestors.
|
1998
|
-
|
1999
|
-
Fixes #11569.
|
2000
|
-
|
2001
|
-
*Godfrey Chan*
|
2002
|
-
|
2003
|
-
* Coerce strings when reading attributes. Fixes #10485.
|
2004
|
-
|
2005
|
-
Example:
|
2006
|
-
|
2007
|
-
book = Book.new(title: 12345)
|
2008
|
-
book.save!
|
2009
|
-
book.title # => "12345"
|
2010
|
-
|
2011
|
-
*Yves Senn*
|
2012
|
-
|
2013
|
-
* Deprecate half-baked support for PostgreSQL range values with excluding beginnings.
|
2014
|
-
We currently map PostgreSQL ranges to Ruby ranges. This conversion is not fully
|
2015
|
-
possible because the Ruby range does not support excluded beginnings.
|
2016
|
-
|
2017
|
-
The current solution of incrementing the beginning is not correct and is now
|
2018
|
-
deprecated. For subtypes where we don't know how to increment (e.g. `#succ`
|
2019
|
-
is not defined) it will raise an `ArgumentException` for ranges with excluding
|
2020
|
-
beginnings.
|
2021
|
-
|
2022
|
-
*Yves Senn*
|
2023
|
-
|
2024
|
-
* Support for user created range types in PostgreSQL.
|
979
|
+
*Kevin McPhillips*
|
2025
980
|
|
2026
|
-
*Yves Senn*
|
2027
981
|
|
2028
|
-
Please check [
|
982
|
+
Please check [5-1-stable](https://github.com/rails/rails/blob/5-1-stable/activerecord/CHANGELOG.md) for previous changes.
|