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