activerecord 5.2.3
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 +7 -0
- data/CHANGELOG.md +937 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +217 -0
- data/examples/performance.rb +185 -0
- data/examples/simple.rb +15 -0
- data/lib/active_record.rb +188 -0
- data/lib/active_record/aggregations.rb +283 -0
- data/lib/active_record/association_relation.rb +40 -0
- data/lib/active_record/associations.rb +1860 -0
- data/lib/active_record/associations/alias_tracker.rb +81 -0
- data/lib/active_record/associations/association.rb +299 -0
- data/lib/active_record/associations/association_scope.rb +168 -0
- data/lib/active_record/associations/belongs_to_association.rb +130 -0
- data/lib/active_record/associations/belongs_to_polymorphic_association.rb +40 -0
- data/lib/active_record/associations/builder/association.rb +140 -0
- data/lib/active_record/associations/builder/belongs_to.rb +163 -0
- data/lib/active_record/associations/builder/collection_association.rb +82 -0
- data/lib/active_record/associations/builder/has_and_belongs_to_many.rb +135 -0
- data/lib/active_record/associations/builder/has_many.rb +17 -0
- data/lib/active_record/associations/builder/has_one.rb +30 -0
- data/lib/active_record/associations/builder/singular_association.rb +42 -0
- data/lib/active_record/associations/collection_association.rb +513 -0
- data/lib/active_record/associations/collection_proxy.rb +1131 -0
- data/lib/active_record/associations/foreign_association.rb +13 -0
- data/lib/active_record/associations/has_many_association.rb +144 -0
- data/lib/active_record/associations/has_many_through_association.rb +227 -0
- data/lib/active_record/associations/has_one_association.rb +120 -0
- data/lib/active_record/associations/has_one_through_association.rb +45 -0
- data/lib/active_record/associations/join_dependency.rb +262 -0
- data/lib/active_record/associations/join_dependency/join_association.rb +60 -0
- data/lib/active_record/associations/join_dependency/join_base.rb +23 -0
- data/lib/active_record/associations/join_dependency/join_part.rb +71 -0
- data/lib/active_record/associations/preloader.rb +193 -0
- data/lib/active_record/associations/preloader/association.rb +131 -0
- data/lib/active_record/associations/preloader/through_association.rb +107 -0
- data/lib/active_record/associations/singular_association.rb +73 -0
- data/lib/active_record/associations/through_association.rb +121 -0
- data/lib/active_record/attribute_assignment.rb +88 -0
- data/lib/active_record/attribute_decorators.rb +90 -0
- data/lib/active_record/attribute_methods.rb +492 -0
- data/lib/active_record/attribute_methods/before_type_cast.rb +78 -0
- data/lib/active_record/attribute_methods/dirty.rb +150 -0
- data/lib/active_record/attribute_methods/primary_key.rb +143 -0
- data/lib/active_record/attribute_methods/query.rb +42 -0
- data/lib/active_record/attribute_methods/read.rb +85 -0
- data/lib/active_record/attribute_methods/serialization.rb +90 -0
- data/lib/active_record/attribute_methods/time_zone_conversion.rb +91 -0
- data/lib/active_record/attribute_methods/write.rb +68 -0
- data/lib/active_record/attributes.rb +266 -0
- data/lib/active_record/autosave_association.rb +498 -0
- data/lib/active_record/base.rb +329 -0
- data/lib/active_record/callbacks.rb +353 -0
- data/lib/active_record/coders/json.rb +15 -0
- data/lib/active_record/coders/yaml_column.rb +50 -0
- data/lib/active_record/collection_cache_key.rb +53 -0
- data/lib/active_record/connection_adapters/abstract/connection_pool.rb +1068 -0
- data/lib/active_record/connection_adapters/abstract/database_limits.rb +72 -0
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +540 -0
- data/lib/active_record/connection_adapters/abstract/query_cache.rb +145 -0
- data/lib/active_record/connection_adapters/abstract/quoting.rb +200 -0
- data/lib/active_record/connection_adapters/abstract/savepoints.rb +23 -0
- data/lib/active_record/connection_adapters/abstract/schema_creation.rb +146 -0
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +685 -0
- data/lib/active_record/connection_adapters/abstract/schema_dumper.rb +95 -0
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +1396 -0
- data/lib/active_record/connection_adapters/abstract/transaction.rb +283 -0
- data/lib/active_record/connection_adapters/abstract_adapter.rb +628 -0
- data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +887 -0
- data/lib/active_record/connection_adapters/column.rb +91 -0
- data/lib/active_record/connection_adapters/connection_specification.rb +287 -0
- 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 +129 -0
- data/lib/active_record/connection_adapters/postgresql/column.rb +44 -0
- data/lib/active_record/connection_adapters/postgresql/database_statements.rb +163 -0
- data/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb +44 -0
- data/lib/active_record/connection_adapters/postgresql/oid.rb +34 -0
- data/lib/active_record/connection_adapters/postgresql/oid/array.rb +92 -0
- data/lib/active_record/connection_adapters/postgresql/oid/bit.rb +56 -0
- data/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb +15 -0
- data/lib/active_record/connection_adapters/postgresql/oid/bytea.rb +17 -0
- data/lib/active_record/connection_adapters/postgresql/oid/cidr.rb +50 -0
- data/lib/active_record/connection_adapters/postgresql/oid/date.rb +23 -0
- data/lib/active_record/connection_adapters/postgresql/oid/date_time.rb +23 -0
- data/lib/active_record/connection_adapters/postgresql/oid/decimal.rb +15 -0
- data/lib/active_record/connection_adapters/postgresql/oid/enum.rb +21 -0
- data/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +71 -0
- data/lib/active_record/connection_adapters/postgresql/oid/inet.rb +15 -0
- data/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb +15 -0
- data/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb +45 -0
- data/lib/active_record/connection_adapters/postgresql/oid/money.rb +41 -0
- data/lib/active_record/connection_adapters/postgresql/oid/oid.rb +15 -0
- data/lib/active_record/connection_adapters/postgresql/oid/point.rb +65 -0
- data/lib/active_record/connection_adapters/postgresql/oid/range.rb +97 -0
- data/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb +18 -0
- data/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb +111 -0
- data/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +23 -0
- data/lib/active_record/connection_adapters/postgresql/oid/vector.rb +28 -0
- data/lib/active_record/connection_adapters/postgresql/oid/xml.rb +30 -0
- data/lib/active_record/connection_adapters/postgresql/quoting.rb +168 -0
- data/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +43 -0
- data/lib/active_record/connection_adapters/postgresql/schema_creation.rb +65 -0
- data/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +206 -0
- data/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +50 -0
- data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +774 -0
- data/lib/active_record/connection_adapters/postgresql/type_metadata.rb +39 -0
- data/lib/active_record/connection_adapters/postgresql/utils.rb +81 -0
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +863 -0
- data/lib/active_record/connection_adapters/schema_cache.rb +118 -0
- 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 +573 -0
- data/lib/active_record/connection_adapters/statement_pool.rb +61 -0
- data/lib/active_record/connection_handling.rb +145 -0
- data/lib/active_record/core.rb +559 -0
- data/lib/active_record/counter_cache.rb +218 -0
- data/lib/active_record/define_callbacks.rb +22 -0
- data/lib/active_record/dynamic_matchers.rb +122 -0
- data/lib/active_record/enum.rb +244 -0
- data/lib/active_record/errors.rb +380 -0
- data/lib/active_record/explain.rb +50 -0
- data/lib/active_record/explain_registry.rb +32 -0
- data/lib/active_record/explain_subscriber.rb +34 -0
- data/lib/active_record/fixture_set/file.rb +82 -0
- data/lib/active_record/fixtures.rb +1065 -0
- data/lib/active_record/gem_version.rb +17 -0
- data/lib/active_record/inheritance.rb +283 -0
- data/lib/active_record/integration.rb +155 -0
- data/lib/active_record/internal_metadata.rb +45 -0
- data/lib/active_record/legacy_yaml_adapter.rb +48 -0
- data/lib/active_record/locale/en.yml +48 -0
- data/lib/active_record/locking/optimistic.rb +198 -0
- data/lib/active_record/locking/pessimistic.rb +89 -0
- data/lib/active_record/log_subscriber.rb +137 -0
- data/lib/active_record/migration.rb +1378 -0
- data/lib/active_record/migration/command_recorder.rb +240 -0
- data/lib/active_record/migration/compatibility.rb +217 -0
- data/lib/active_record/migration/join_table.rb +17 -0
- data/lib/active_record/model_schema.rb +521 -0
- data/lib/active_record/nested_attributes.rb +600 -0
- data/lib/active_record/no_touching.rb +58 -0
- data/lib/active_record/null_relation.rb +68 -0
- data/lib/active_record/persistence.rb +763 -0
- data/lib/active_record/query_cache.rb +45 -0
- data/lib/active_record/querying.rb +70 -0
- data/lib/active_record/railtie.rb +226 -0
- data/lib/active_record/railties/console_sandbox.rb +7 -0
- data/lib/active_record/railties/controller_runtime.rb +56 -0
- data/lib/active_record/railties/databases.rake +377 -0
- data/lib/active_record/readonly_attributes.rb +24 -0
- data/lib/active_record/reflection.rb +1044 -0
- data/lib/active_record/relation.rb +629 -0
- data/lib/active_record/relation/batches.rb +287 -0
- data/lib/active_record/relation/batches/batch_enumerator.rb +69 -0
- data/lib/active_record/relation/calculations.rb +417 -0
- data/lib/active_record/relation/delegation.rb +147 -0
- data/lib/active_record/relation/finder_methods.rb +565 -0
- data/lib/active_record/relation/from_clause.rb +26 -0
- data/lib/active_record/relation/merger.rb +193 -0
- data/lib/active_record/relation/predicate_builder.rb +152 -0
- data/lib/active_record/relation/predicate_builder/array_handler.rb +48 -0
- 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 +19 -0
- data/lib/active_record/relation/query_attribute.rb +45 -0
- data/lib/active_record/relation/query_methods.rb +1231 -0
- data/lib/active_record/relation/record_fetch_warning.rb +51 -0
- data/lib/active_record/relation/spawn_methods.rb +77 -0
- 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/result.rb +149 -0
- data/lib/active_record/runtime_registry.rb +24 -0
- data/lib/active_record/sanitization.rb +222 -0
- data/lib/active_record/schema.rb +70 -0
- data/lib/active_record/schema_dumper.rb +255 -0
- data/lib/active_record/schema_migration.rb +56 -0
- data/lib/active_record/scoping.rb +106 -0
- data/lib/active_record/scoping/default.rb +152 -0
- data/lib/active_record/scoping/named.rb +213 -0
- data/lib/active_record/secure_token.rb +40 -0
- data/lib/active_record/serialization.rb +22 -0
- data/lib/active_record/statement_cache.rb +121 -0
- data/lib/active_record/store.rb +211 -0
- 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 +337 -0
- data/lib/active_record/tasks/mysql_database_tasks.rb +115 -0
- data/lib/active_record/tasks/postgresql_database_tasks.rb +143 -0
- data/lib/active_record/tasks/sqlite_database_tasks.rb +83 -0
- data/lib/active_record/timestamp.rb +153 -0
- data/lib/active_record/touch_later.rb +64 -0
- data/lib/active_record/transactions.rb +502 -0
- data/lib/active_record/translation.rb +24 -0
- data/lib/active_record/type.rb +79 -0
- data/lib/active_record/type/adapter_specific_registry.rb +136 -0
- data/lib/active_record/type/date.rb +9 -0
- data/lib/active_record/type/date_time.rb +9 -0
- data/lib/active_record/type/decimal_without_scale.rb +15 -0
- data/lib/active_record/type/hash_lookup_type_map.rb +25 -0
- 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 +71 -0
- data/lib/active_record/type/text.rb +11 -0
- data/lib/active_record/type/time.rb +21 -0
- data/lib/active_record/type/type_map.rb +62 -0
- data/lib/active_record/type/unsigned_integer.rb +17 -0
- data/lib/active_record/type_caster.rb +9 -0
- data/lib/active_record/type_caster/connection.rb +33 -0
- data/lib/active_record/type_caster/map.rb +23 -0
- data/lib/active_record/validations.rb +93 -0
- data/lib/active_record/validations/absence.rb +25 -0
- data/lib/active_record/validations/associated.rb +60 -0
- data/lib/active_record/validations/length.rb +26 -0
- data/lib/active_record/validations/presence.rb +68 -0
- data/lib/active_record/validations/uniqueness.rb +238 -0
- data/lib/active_record/version.rb +10 -0
- data/lib/rails/generators/active_record.rb +19 -0
- 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.rb +35 -0
- data/lib/rails/generators/active_record/migration/migration_generator.rb +78 -0
- data/lib/rails/generators/active_record/migration/templates/create_table_migration.rb.tt +24 -0
- data/lib/rails/generators/active_record/migration/templates/migration.rb.tt +46 -0
- data/lib/rails/generators/active_record/model/model_generator.rb +48 -0
- data/lib/rails/generators/active_record/model/templates/model.rb.tt +13 -0
- data/lib/rails/generators/active_record/model/templates/module.rb.tt +7 -0
- metadata +333 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3a6a58445af3e133df097836131d528804585b935b40025174db5e3a284351b5
|
4
|
+
data.tar.gz: 4d1b7fbc93cb5582065167d8d8a197ed887133b06170c5acf0ab6a18dea29465
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c91429dea93398c1c532da4f5a66435b73842887a4d0f86782dfb19ba3801dfa65e04410a26f503e18cbc434793f293c051c7844a3702a638f14443711d7d6ea
|
7
|
+
data.tar.gz: a224f223a6f2da2ac314fa2d6f0deb4befbb0a962cad19d8a5c93a769ffd45450d23df71d791dfadae0b56435207beee54e5126e2e9cee50e9678fbe233fff9b
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,937 @@
|
|
1
|
+
## Rails 5.2.3 (March 27, 2019) ##
|
2
|
+
|
3
|
+
* Fix different `count` calculation when using `size` with manual `select` with DISTINCT.
|
4
|
+
|
5
|
+
Fixes #35214.
|
6
|
+
|
7
|
+
*Juani Villarejo*
|
8
|
+
|
9
|
+
* Fix prepared statements caching to be enabled even when query caching is enabled.
|
10
|
+
|
11
|
+
*Ryuta Kamizono*
|
12
|
+
|
13
|
+
* Don't allow `where` with invalid value matches to nil values.
|
14
|
+
|
15
|
+
Fixes #33624.
|
16
|
+
|
17
|
+
*Ryuta Kamizono*
|
18
|
+
|
19
|
+
* Restore an ability that class level `update` without giving ids.
|
20
|
+
|
21
|
+
Fixes #34743.
|
22
|
+
|
23
|
+
*Ryuta Kamizono*
|
24
|
+
|
25
|
+
* Fix join table column quoting with SQLite.
|
26
|
+
|
27
|
+
*Gannon McGibbon*
|
28
|
+
|
29
|
+
* Ensure that `delete_all` on collection proxy returns affected count.
|
30
|
+
|
31
|
+
*Ryuta Kamizono*
|
32
|
+
|
33
|
+
* Reset scope after delete on collection association to clear stale offsets of removed records.
|
34
|
+
|
35
|
+
*Gannon McGibbon*
|
36
|
+
|
37
|
+
|
38
|
+
## Rails 5.2.2.1 (March 11, 2019) ##
|
39
|
+
|
40
|
+
* No changes.
|
41
|
+
|
42
|
+
|
43
|
+
## Rails 5.2.2 (December 04, 2018) ##
|
44
|
+
|
45
|
+
* Do not ignore the scoping with query methods in the scope block.
|
46
|
+
|
47
|
+
*Ryuta Kamizono*
|
48
|
+
|
49
|
+
* Allow aliased attributes to be used in `#update_columns` and `#update`.
|
50
|
+
|
51
|
+
*Gannon McGibbon*
|
52
|
+
|
53
|
+
* Allow spaces in postgres table names.
|
54
|
+
|
55
|
+
Fixes issue where "user post" is misinterpreted as "\"user\".\"post\"" when quoting table names with the postgres
|
56
|
+
adapter.
|
57
|
+
|
58
|
+
*Gannon McGibbon*
|
59
|
+
|
60
|
+
* Cached columns_hash fields should be excluded from ResultSet#column_types
|
61
|
+
|
62
|
+
PR #34528 addresses the inconsistent behaviour when attribute is defined for an ignored column. The following test
|
63
|
+
was passing for SQLite and MySQL, but failed for PostgreSQL:
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
class DeveloperName < ActiveRecord::Type::String
|
67
|
+
def deserialize(value)
|
68
|
+
"Developer: #{value}"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
class AttributedDeveloper < ActiveRecord::Base
|
73
|
+
self.table_name = "developers"
|
74
|
+
|
75
|
+
attribute :name, DeveloperName.new
|
76
|
+
|
77
|
+
self.ignored_columns += ["name"]
|
78
|
+
end
|
79
|
+
|
80
|
+
developer = AttributedDeveloper.create
|
81
|
+
developer.update_column :name, "name"
|
82
|
+
|
83
|
+
loaded_developer = AttributedDeveloper.where(id: developer.id).select("*").first
|
84
|
+
puts loaded_developer.name # should be "Developer: name" but it's just "name"
|
85
|
+
```
|
86
|
+
|
87
|
+
*Dmitry Tsepelev*
|
88
|
+
|
89
|
+
* Values of enum are frozen, raising an error when attempting to modify them.
|
90
|
+
|
91
|
+
*Emmanuel Byrd*
|
92
|
+
|
93
|
+
* `update_columns` now correctly raises `ActiveModel::MissingAttributeError`
|
94
|
+
if the attribute does not exist.
|
95
|
+
|
96
|
+
*Sean Griffin*
|
97
|
+
|
98
|
+
* Do not use prepared statement in queries that have a large number of binds.
|
99
|
+
|
100
|
+
*Ryuta Kamizono*
|
101
|
+
|
102
|
+
* Fix query cache to load before first request.
|
103
|
+
|
104
|
+
*Eileen M. Uchitelle*
|
105
|
+
|
106
|
+
* Fix collection cache key with limit and custom select to avoid ambiguous timestamp column error.
|
107
|
+
|
108
|
+
Fixes #33056.
|
109
|
+
|
110
|
+
*Federico Martinez*
|
111
|
+
|
112
|
+
* Fix duplicated record creation when using nested attributes with `create_with`.
|
113
|
+
|
114
|
+
*Darwin Wu*
|
115
|
+
|
116
|
+
* Fix regression setting children record in parent `before_save` callback.
|
117
|
+
|
118
|
+
*Guo Xiang Tan*
|
119
|
+
|
120
|
+
* Prevent leaking of user's DB credentials on `rails db:create` failure.
|
121
|
+
|
122
|
+
*bogdanvlviv*
|
123
|
+
|
124
|
+
* Clear mutation tracker before continuing the around callbacks.
|
125
|
+
|
126
|
+
*Yuya Tanaka*
|
127
|
+
|
128
|
+
* Prevent deadlocks when waiting for connection from pool.
|
129
|
+
|
130
|
+
*Brent Wheeldon*
|
131
|
+
|
132
|
+
* Avoid extra scoping when using `Relation#update` that was causing this method to change the current scope.
|
133
|
+
|
134
|
+
*Ryuta Kamizono*
|
135
|
+
|
136
|
+
* Fix numericality validator not to be affected by custom getter.
|
137
|
+
|
138
|
+
*Ryuta Kamizono*
|
139
|
+
|
140
|
+
* Fix bulk change table ignores comment option on PostgreSQL.
|
141
|
+
|
142
|
+
*Yoshiyuki Kinjo*
|
143
|
+
|
144
|
+
|
145
|
+
## Rails 5.2.1.1 (November 27, 2018) ##
|
146
|
+
|
147
|
+
* No changes.
|
148
|
+
|
149
|
+
|
150
|
+
## Rails 5.2.1 (August 07, 2018) ##
|
151
|
+
|
152
|
+
* PostgreSQL: Support new relkind for partitioned tables.
|
153
|
+
|
154
|
+
Fixes #33008.
|
155
|
+
|
156
|
+
*Yannick Schutz*
|
157
|
+
|
158
|
+
* Rollback parent transaction when children fails to update.
|
159
|
+
|
160
|
+
*Guillaume Malette*
|
161
|
+
|
162
|
+
* Fix default value for MySQL time types with specified precision.
|
163
|
+
|
164
|
+
*Nikolay Kondratyev*
|
165
|
+
|
166
|
+
* Fix `touch` option to behave consistently with `Persistence#touch` method.
|
167
|
+
|
168
|
+
*Ryuta Kamizono*
|
169
|
+
|
170
|
+
* Fix `save` in `after_create_commit` won't invoke extra `after_create_commit`.
|
171
|
+
|
172
|
+
Fixes #32831.
|
173
|
+
|
174
|
+
*Ryuta Kamizono*
|
175
|
+
|
176
|
+
* Fix logic on disabling commit callbacks so they are not called unexpectedly when errors occur.
|
177
|
+
|
178
|
+
*Brian Durand*
|
179
|
+
|
180
|
+
* Fix parent record should not get saved with duplicate children records.
|
181
|
+
|
182
|
+
Fixes #32940.
|
183
|
+
|
184
|
+
*Santosh Wadghule*
|
185
|
+
|
186
|
+
* Fix that association's after_touch is not called with counter cache.
|
187
|
+
|
188
|
+
Fixes #31559.
|
189
|
+
|
190
|
+
*Ryuta Kamizono*
|
191
|
+
|
192
|
+
* `becomes` should clear the mutation tracker which is created in `after_initialize`.
|
193
|
+
|
194
|
+
Fixes #32867.
|
195
|
+
|
196
|
+
*Ryuta Kamizono*
|
197
|
+
|
198
|
+
* Allow a belonging to parent object to be created from a new record.
|
199
|
+
|
200
|
+
*Jolyon Pawlyn*
|
201
|
+
|
202
|
+
* Fix that building record with assigning multiple has_one associations
|
203
|
+
wrongly persists through record.
|
204
|
+
|
205
|
+
Fixes #32511.
|
206
|
+
|
207
|
+
*Sam DeCesare*
|
208
|
+
|
209
|
+
* Fix relation merging when one of the relations is going to skip the
|
210
|
+
query cache.
|
211
|
+
|
212
|
+
*James Williams*
|
213
|
+
|
214
|
+
|
215
|
+
## Rails 5.2.0 (April 09, 2018) ##
|
216
|
+
|
217
|
+
* MySQL: Support mysql2 0.5.x.
|
218
|
+
|
219
|
+
*Aaron Stone*
|
220
|
+
|
221
|
+
* Apply time column precision on assignment.
|
222
|
+
|
223
|
+
PR #20317 changed the behavior of datetime columns so that when they
|
224
|
+
have a specified precision then on assignment the value is rounded to
|
225
|
+
that precision. This behavior is now applied to time columns as well.
|
226
|
+
|
227
|
+
Fixes #30301.
|
228
|
+
|
229
|
+
*Andrew White*
|
230
|
+
|
231
|
+
* Normalize time column values for SQLite database.
|
232
|
+
|
233
|
+
For legacy reasons, time columns in SQLite are stored as full datetimes
|
234
|
+
because until #24542 the quoting for time columns didn't remove the date
|
235
|
+
component. To ensure that values are consistent we now normalize the
|
236
|
+
date component to 2001-01-01 on reading and writing.
|
237
|
+
|
238
|
+
*Andrew White*
|
239
|
+
|
240
|
+
* Ensure that the date component is removed when quoting times.
|
241
|
+
|
242
|
+
PR #24542 altered the quoting for time columns so that the date component
|
243
|
+
was removed however it only removed it when it was 2001-01-01. Now the
|
244
|
+
date component is removed irrespective of what the date is.
|
245
|
+
|
246
|
+
*Andrew White*
|
247
|
+
|
248
|
+
* Fix `dependent: :destroy` issue for has_one/belongs_to relationship where
|
249
|
+
the parent class was getting deleted when the child was not.
|
250
|
+
|
251
|
+
Fixes #32022.
|
252
|
+
|
253
|
+
*Fernando Gorodscy*
|
254
|
+
|
255
|
+
* Whitelist `NULLS FIRST` and `NULLS LAST` in order clauses too.
|
256
|
+
|
257
|
+
*Xavier Noria*
|
258
|
+
|
259
|
+
* Fix that after commit callbacks on update does not triggered when optimistic locking is enabled.
|
260
|
+
|
261
|
+
*Ryuta Kamizono*
|
262
|
+
|
263
|
+
* Fix `#columns_for_distinct` of MySQL and PostgreSQL to make
|
264
|
+
`ActiveRecord::FinderMethods#limited_ids_for` use correct primary key values
|
265
|
+
even if `ORDER BY` columns include other table's primary key.
|
266
|
+
|
267
|
+
Fixes #28364.
|
268
|
+
|
269
|
+
*Takumi Kagiyama*
|
270
|
+
|
271
|
+
* Make `reflection.klass` raise if `polymorphic?` not to be misused.
|
272
|
+
|
273
|
+
Fixes #31876.
|
274
|
+
|
275
|
+
*Ryuta Kamizono*
|
276
|
+
|
277
|
+
* PostgreSQL: Allow pg-1.0 gem to be used with Active Record.
|
278
|
+
|
279
|
+
*Lars Kanis*
|
280
|
+
|
281
|
+
* Deprecate `expand_hash_conditions_for_aggregates` without replacement.
|
282
|
+
Using a `Relation` for performing queries is the prefered API.
|
283
|
+
|
284
|
+
*Ryuta Kamizono*
|
285
|
+
|
286
|
+
* Fix not expanded problem when passing an Array object as argument to the where method using `composed_of` column.
|
287
|
+
|
288
|
+
```
|
289
|
+
david_balance = customers(:david).balance
|
290
|
+
Customer.where(balance: [david_balance]).to_sql
|
291
|
+
|
292
|
+
# Before: WHERE `customers`.`balance` = NULL
|
293
|
+
# After : WHERE `customers`.`balance` = 50
|
294
|
+
```
|
295
|
+
|
296
|
+
Fixes #31723.
|
297
|
+
|
298
|
+
*Yutaro Kanagawa*
|
299
|
+
|
300
|
+
* Fix `count(:all)` with eager loading and having an order other than the driving table.
|
301
|
+
|
302
|
+
Fixes #31783.
|
303
|
+
|
304
|
+
*Ryuta Kamizono*
|
305
|
+
|
306
|
+
* Clear the transaction state when an Active Record object is duped.
|
307
|
+
|
308
|
+
Fixes #31670.
|
309
|
+
|
310
|
+
*Yuriy Ustushenko*
|
311
|
+
|
312
|
+
* Support for PostgreSQL foreign tables.
|
313
|
+
|
314
|
+
*fatkodima*
|
315
|
+
|
316
|
+
* Fix relation merger issue with `left_outer_joins`.
|
317
|
+
|
318
|
+
*Mehmet Emin İNAÇ*
|
319
|
+
|
320
|
+
* Don't allow destroyed object mutation after `save` or `save!` is called.
|
321
|
+
|
322
|
+
*Ryuta Kamizono*
|
323
|
+
|
324
|
+
* Take into account association conditions when deleting through records.
|
325
|
+
|
326
|
+
Fixes #18424.
|
327
|
+
|
328
|
+
*Piotr Jakubowski*
|
329
|
+
|
330
|
+
* Fix nested `has_many :through` associations on unpersisted parent instances.
|
331
|
+
|
332
|
+
For example, if you have
|
333
|
+
|
334
|
+
class Post < ActiveRecord::Base
|
335
|
+
belongs_to :author
|
336
|
+
has_many :books, through: :author
|
337
|
+
has_many :subscriptions, through: :books
|
338
|
+
end
|
339
|
+
|
340
|
+
class Author < ActiveRecord::Base
|
341
|
+
has_one :post
|
342
|
+
has_many :books
|
343
|
+
has_many :subscriptions, through: :books
|
344
|
+
end
|
345
|
+
|
346
|
+
class Book < ActiveRecord::Base
|
347
|
+
belongs_to :author
|
348
|
+
has_many :subscriptions
|
349
|
+
end
|
350
|
+
|
351
|
+
class Subscription < ActiveRecord::Base
|
352
|
+
belongs_to :book
|
353
|
+
end
|
354
|
+
|
355
|
+
Before:
|
356
|
+
|
357
|
+
If `post` is not persisted, then `post.subscriptions` will be empty.
|
358
|
+
|
359
|
+
After:
|
360
|
+
|
361
|
+
If `post` is not persisted, then `post.subscriptions` can be set and used
|
362
|
+
just like it would if `post` were persisted.
|
363
|
+
|
364
|
+
Fixes #16313.
|
365
|
+
|
366
|
+
*Zoltan Kiss*
|
367
|
+
|
368
|
+
* Fixed inconsistency with `first(n)` when used with `limit()`.
|
369
|
+
The `first(n)` finder now respects the `limit()`, making it consistent
|
370
|
+
with `relation.to_a.first(n)`, and also with the behavior of `last(n)`.
|
371
|
+
|
372
|
+
Fixes #23979.
|
373
|
+
|
374
|
+
*Brian Christian*
|
375
|
+
|
376
|
+
* Use `count(:all)` in `HasManyAssociation#count_records` to prevent invalid
|
377
|
+
SQL queries for association counting.
|
378
|
+
|
379
|
+
*Klas Eskilson*
|
380
|
+
|
381
|
+
* Fix to invoke callbacks when using `update_attribute`.
|
382
|
+
|
383
|
+
*Mike Busch*
|
384
|
+
|
385
|
+
* Fix `count(:all)` to correctly work `distinct` with custom SELECT list.
|
386
|
+
|
387
|
+
*Ryuta Kamizono*
|
388
|
+
|
389
|
+
* Using subselect for `delete_all` with `limit` or `offset`.
|
390
|
+
|
391
|
+
*Ryuta Kamizono*
|
392
|
+
|
393
|
+
* Undefine attribute methods on descendants when resetting column
|
394
|
+
information.
|
395
|
+
|
396
|
+
*Chris Salzberg*
|
397
|
+
|
398
|
+
* Log database query callers.
|
399
|
+
|
400
|
+
Add `verbose_query_logs` configuration option to display the caller
|
401
|
+
of database queries in the log to facilitate N+1 query resolution
|
402
|
+
and other debugging.
|
403
|
+
|
404
|
+
Enabled in development only for new and upgraded applications. Not
|
405
|
+
recommended for use in the production environment since it relies
|
406
|
+
on Ruby's `Kernel#caller_locations` which is fairly slow.
|
407
|
+
|
408
|
+
*Olivier Lacan*
|
409
|
+
|
410
|
+
* Fix conflicts `counter_cache` with `touch: true` by optimistic locking.
|
411
|
+
|
412
|
+
```
|
413
|
+
# create_table :posts do |t|
|
414
|
+
# t.integer :comments_count, default: 0
|
415
|
+
# t.integer :lock_version
|
416
|
+
# t.timestamps
|
417
|
+
# end
|
418
|
+
class Post < ApplicationRecord
|
419
|
+
end
|
420
|
+
|
421
|
+
# create_table :comments do |t|
|
422
|
+
# t.belongs_to :post
|
423
|
+
# end
|
424
|
+
class Comment < ApplicationRecord
|
425
|
+
belongs_to :post, touch: true, counter_cache: true
|
426
|
+
end
|
427
|
+
```
|
428
|
+
|
429
|
+
Before:
|
430
|
+
```
|
431
|
+
post = Post.create!
|
432
|
+
# => begin transaction
|
433
|
+
INSERT INTO "posts" ("created_at", "updated_at", "lock_version")
|
434
|
+
VALUES ("2017-12-11 21:27:11.387397", "2017-12-11 21:27:11.387397", 0)
|
435
|
+
commit transaction
|
436
|
+
|
437
|
+
comment = Comment.create!(post: post)
|
438
|
+
# => begin transaction
|
439
|
+
INSERT INTO "comments" ("post_id") VALUES (1)
|
440
|
+
|
441
|
+
UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1,
|
442
|
+
"lock_version" = COALESCE("lock_version", 0) + 1 WHERE "posts"."id" = 1
|
443
|
+
|
444
|
+
UPDATE "posts" SET "updated_at" = '2017-12-11 21:27:11.398330',
|
445
|
+
"lock_version" = 1 WHERE "posts"."id" = 1 AND "posts"."lock_version" = 0
|
446
|
+
rollback transaction
|
447
|
+
# => ActiveRecord::StaleObjectError: Attempted to touch a stale object: Post.
|
448
|
+
|
449
|
+
Comment.take.destroy!
|
450
|
+
# => begin transaction
|
451
|
+
DELETE FROM "comments" WHERE "comments"."id" = 1
|
452
|
+
|
453
|
+
UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) - 1,
|
454
|
+
"lock_version" = COALESCE("lock_version", 0) + 1 WHERE "posts"."id" = 1
|
455
|
+
|
456
|
+
UPDATE "posts" SET "updated_at" = '2017-12-11 21:42:47.785901',
|
457
|
+
"lock_version" = 1 WHERE "posts"."id" = 1 AND "posts"."lock_version" = 0
|
458
|
+
rollback transaction
|
459
|
+
# => ActiveRecord::StaleObjectError: Attempted to touch a stale object: Post.
|
460
|
+
```
|
461
|
+
|
462
|
+
After:
|
463
|
+
```
|
464
|
+
post = Post.create!
|
465
|
+
# => begin transaction
|
466
|
+
INSERT INTO "posts" ("created_at", "updated_at", "lock_version")
|
467
|
+
VALUES ("2017-12-11 21:27:11.387397", "2017-12-11 21:27:11.387397", 0)
|
468
|
+
commit transaction
|
469
|
+
|
470
|
+
comment = Comment.create!(post: post)
|
471
|
+
# => begin transaction
|
472
|
+
INSERT INTO "comments" ("post_id") VALUES (1)
|
473
|
+
|
474
|
+
UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1,
|
475
|
+
"lock_version" = COALESCE("lock_version", 0) + 1,
|
476
|
+
"updated_at" = '2017-12-11 21:37:09.802642' WHERE "posts"."id" = 1
|
477
|
+
commit transaction
|
478
|
+
|
479
|
+
comment.destroy!
|
480
|
+
# => begin transaction
|
481
|
+
DELETE FROM "comments" WHERE "comments"."id" = 1
|
482
|
+
|
483
|
+
UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) - 1,
|
484
|
+
"lock_version" = COALESCE("lock_version", 0) + 1,
|
485
|
+
"updated_at" = '2017-12-11 21:39:02.685520' WHERE "posts"."id" = 1
|
486
|
+
commit transaction
|
487
|
+
```
|
488
|
+
|
489
|
+
Fixes #31199.
|
490
|
+
|
491
|
+
*bogdanvlviv*
|
492
|
+
|
493
|
+
* Add support for PostgreSQL operator classes to `add_index`.
|
494
|
+
|
495
|
+
Example:
|
496
|
+
|
497
|
+
add_index :users, :name, using: :gist, opclass: { name: :gist_trgm_ops }
|
498
|
+
|
499
|
+
*Greg Navis*
|
500
|
+
|
501
|
+
* Don't allow scopes to be defined which conflict with instance methods on `Relation`.
|
502
|
+
|
503
|
+
Fixes #31120.
|
504
|
+
|
505
|
+
*kinnrot*
|
506
|
+
|
507
|
+
* Add new error class `QueryCanceled` which will be raised
|
508
|
+
when canceling statement due to user request.
|
509
|
+
|
510
|
+
*Ryuta Kamizono*
|
511
|
+
|
512
|
+
* Add `#up_only` to database migrations for code that is only relevant when
|
513
|
+
migrating up, e.g. populating a new column.
|
514
|
+
|
515
|
+
*Rich Daley*
|
516
|
+
|
517
|
+
* Require raw SQL fragments to be explicitly marked when used in
|
518
|
+
relation query methods.
|
519
|
+
|
520
|
+
Before:
|
521
|
+
```
|
522
|
+
Article.order("LENGTH(title)")
|
523
|
+
```
|
524
|
+
|
525
|
+
After:
|
526
|
+
```
|
527
|
+
Article.order(Arel.sql("LENGTH(title)"))
|
528
|
+
```
|
529
|
+
|
530
|
+
This prevents SQL injection if applications use the [strongly
|
531
|
+
discouraged] form `Article.order(params[:my_order])`, under the
|
532
|
+
mistaken belief that only column names will be accepted.
|
533
|
+
|
534
|
+
Raw SQL strings will now cause a deprecation warning, which will
|
535
|
+
become an UnknownAttributeReference error in Rails 6.0. Applications
|
536
|
+
can opt in to the future behavior by setting `allow_unsafe_raw_sql`
|
537
|
+
to `:disabled`.
|
538
|
+
|
539
|
+
Common and judged-safe string values (such as simple column
|
540
|
+
references) are unaffected:
|
541
|
+
```
|
542
|
+
Article.order("title DESC")
|
543
|
+
```
|
544
|
+
|
545
|
+
*Ben Toews*
|
546
|
+
|
547
|
+
* `update_all` will now pass its values to `Type#cast` before passing them to
|
548
|
+
`Type#serialize`. This means that `update_all(foo: 'true')` will properly
|
549
|
+
persist a boolean.
|
550
|
+
|
551
|
+
*Sean Griffin*
|
552
|
+
|
553
|
+
* Add new error class `StatementTimeout` which will be raised
|
554
|
+
when statement timeout exceeded.
|
555
|
+
|
556
|
+
*Ryuta Kamizono*
|
557
|
+
|
558
|
+
* Fix `bin/rails db:migrate` with specified `VERSION`.
|
559
|
+
`bin/rails db:migrate` with empty VERSION behaves as without `VERSION`.
|
560
|
+
Check a format of `VERSION`: Allow a migration version number
|
561
|
+
or name of a migration file. Raise error if format of `VERSION` is invalid.
|
562
|
+
Raise error if target migration doesn't exist.
|
563
|
+
|
564
|
+
*bogdanvlviv*
|
565
|
+
|
566
|
+
* Fixed a bug where column orders for an index weren't written to
|
567
|
+
`db/schema.rb` when using the sqlite adapter.
|
568
|
+
|
569
|
+
Fixes #30902.
|
570
|
+
|
571
|
+
*Paul Kuruvilla*
|
572
|
+
|
573
|
+
* Remove deprecated method `#sanitize_conditions`.
|
574
|
+
|
575
|
+
*Rafael Mendonça França*
|
576
|
+
|
577
|
+
* Remove deprecated method `#scope_chain`.
|
578
|
+
|
579
|
+
*Rafael Mendonça França*
|
580
|
+
|
581
|
+
* Remove deprecated configuration `.error_on_ignored_order_or_limit`.
|
582
|
+
|
583
|
+
*Rafael Mendonça França*
|
584
|
+
|
585
|
+
* Remove deprecated arguments from `#verify!`.
|
586
|
+
|
587
|
+
*Rafael Mendonça França*
|
588
|
+
|
589
|
+
* Remove deprecated argument `name` from `#indexes`.
|
590
|
+
|
591
|
+
*Rafael Mendonça França*
|
592
|
+
|
593
|
+
* Remove deprecated method `ActiveRecord::Migrator.schema_migrations_table_name`.
|
594
|
+
|
595
|
+
*Rafael Mendonça França*
|
596
|
+
|
597
|
+
* Remove deprecated method `supports_primary_key?`.
|
598
|
+
|
599
|
+
*Rafael Mendonça França*
|
600
|
+
|
601
|
+
* Remove deprecated method `supports_migrations?`.
|
602
|
+
|
603
|
+
*Rafael Mendonça França*
|
604
|
+
|
605
|
+
* Remove deprecated methods `initialize_schema_migrations_table` and `initialize_internal_metadata_table`.
|
606
|
+
|
607
|
+
*Rafael Mendonça França*
|
608
|
+
|
609
|
+
* Raises when calling `lock!` in a dirty record.
|
610
|
+
|
611
|
+
*Rafael Mendonça França*
|
612
|
+
|
613
|
+
* Remove deprecated support to passing a class to `:class_name` on associations.
|
614
|
+
|
615
|
+
*Rafael Mendonça França*
|
616
|
+
|
617
|
+
* Remove deprecated argument `default` from `index_name_exists?`.
|
618
|
+
|
619
|
+
*Rafael Mendonça França*
|
620
|
+
|
621
|
+
* Remove deprecated support to `quoted_id` when typecasting an Active Record object.
|
622
|
+
|
623
|
+
*Rafael Mendonça França*
|
624
|
+
|
625
|
+
* Fix `bin/rails db:setup` and `bin/rails db:test:prepare` create wrong
|
626
|
+
ar_internal_metadata's data for a test database.
|
627
|
+
|
628
|
+
Before:
|
629
|
+
```
|
630
|
+
$ RAILS_ENV=test rails dbconsole
|
631
|
+
> SELECT * FROM ar_internal_metadata;
|
632
|
+
key|value|created_at|updated_at
|
633
|
+
environment|development|2017-09-11 23:14:10.815679|2017-09-11 23:14:10.815679
|
634
|
+
```
|
635
|
+
|
636
|
+
After:
|
637
|
+
```
|
638
|
+
$ RAILS_ENV=test rails dbconsole
|
639
|
+
> SELECT * FROM ar_internal_metadata;
|
640
|
+
key|value|created_at|updated_at
|
641
|
+
environment|test|2017-09-11 23:14:10.815679|2017-09-11 23:14:10.815679
|
642
|
+
```
|
643
|
+
|
644
|
+
Fixes #26731.
|
645
|
+
|
646
|
+
*bogdanvlviv*
|
647
|
+
|
648
|
+
* Fix longer sequence name detection for serial columns.
|
649
|
+
|
650
|
+
Fixes #28332.
|
651
|
+
|
652
|
+
*Ryuta Kamizono*
|
653
|
+
|
654
|
+
* MySQL: Don't lose `auto_increment: true` in the `db/schema.rb`.
|
655
|
+
|
656
|
+
Fixes #30894.
|
657
|
+
|
658
|
+
*Ryuta Kamizono*
|
659
|
+
|
660
|
+
* Fix `COUNT(DISTINCT ...)` for `GROUP BY` with `ORDER BY` and `LIMIT`.
|
661
|
+
|
662
|
+
Fixes #30886.
|
663
|
+
|
664
|
+
*Ryuta Kamizono*
|
665
|
+
|
666
|
+
* PostgreSQL `tsrange` now preserves subsecond precision.
|
667
|
+
|
668
|
+
PostgreSQL 9.1+ introduced range types, and Rails added support for using
|
669
|
+
this datatype in Active Record. However, the serialization of
|
670
|
+
`PostgreSQL::OID::Range` was incomplete, because it did not properly
|
671
|
+
cast the bounds that make up the range. This led to subseconds being
|
672
|
+
dropped in SQL commands:
|
673
|
+
|
674
|
+
Before:
|
675
|
+
|
676
|
+
connection.type_cast(tsrange.serialize(range_value))
|
677
|
+
# => "[2010-01-01 13:30:00 UTC,2011-02-02 19:30:00 UTC)"
|
678
|
+
|
679
|
+
Now:
|
680
|
+
|
681
|
+
connection.type_cast(tsrange.serialize(range_value))
|
682
|
+
# => "[2010-01-01 13:30:00.670277,2011-02-02 19:30:00.745125)"
|
683
|
+
|
684
|
+
*Thomas Cannon*
|
685
|
+
|
686
|
+
* Passing a `Set` to `Relation#where` now behaves the same as passing an
|
687
|
+
array.
|
688
|
+
|
689
|
+
*Sean Griffin*
|
690
|
+
|
691
|
+
* Use given algorithm while removing index from database.
|
692
|
+
|
693
|
+
Fixes #24190.
|
694
|
+
|
695
|
+
*Mehmet Emin İNAÇ*
|
696
|
+
|
697
|
+
* Update payload names for `sql.active_record` instrumentation to be
|
698
|
+
more descriptive.
|
699
|
+
|
700
|
+
Fixes #30586.
|
701
|
+
|
702
|
+
*Jeremy Green*
|
703
|
+
|
704
|
+
* Add new error class `LockWaitTimeout` which will be raised
|
705
|
+
when lock wait timeout exceeded.
|
706
|
+
|
707
|
+
*Gabriel Courtemanche*
|
708
|
+
|
709
|
+
* Remove deprecated `#migration_keys`.
|
710
|
+
|
711
|
+
*Ryuta Kamizono*
|
712
|
+
|
713
|
+
* Automatically guess the inverse associations for STI.
|
714
|
+
|
715
|
+
*Yuichiro Kaneko*
|
716
|
+
|
717
|
+
* Ensure `sum` honors `distinct` on `has_many :through` associations.
|
718
|
+
|
719
|
+
Fixes #16791.
|
720
|
+
|
721
|
+
*Aaron Wortham*
|
722
|
+
|
723
|
+
* Add `binary` fixture helper method.
|
724
|
+
|
725
|
+
*Atsushi Yoshida*
|
726
|
+
|
727
|
+
* When using `Relation#or`, extract the common conditions and put them before the OR condition.
|
728
|
+
|
729
|
+
*Maxime Handfield Lapointe*
|
730
|
+
|
731
|
+
* `Relation#or` now accepts two relations who have different values for
|
732
|
+
`references` only, as `references` can be implicitly called by `where`.
|
733
|
+
|
734
|
+
Fixes #29411.
|
735
|
+
|
736
|
+
*Sean Griffin*
|
737
|
+
|
738
|
+
* `ApplicationRecord` is no longer generated when generating models. If you
|
739
|
+
need to generate it, it can be created with `rails g application_record`.
|
740
|
+
|
741
|
+
*Lisa Ugray*
|
742
|
+
|
743
|
+
* Fix `COUNT(DISTINCT ...)` with `ORDER BY` and `LIMIT` to keep the existing select list.
|
744
|
+
|
745
|
+
*Ryuta Kamizono*
|
746
|
+
|
747
|
+
* When a `has_one` association is destroyed by `dependent: destroy`,
|
748
|
+
`destroyed_by_association` will now be set to the reflection, matching the
|
749
|
+
behaviour of `has_many` associations.
|
750
|
+
|
751
|
+
*Lisa Ugray*
|
752
|
+
|
753
|
+
* Fix `unscoped(where: [columns])` removing the wrong bind values.
|
754
|
+
|
755
|
+
When the `where` is called on a relation after a `or`, unscoping the column of that later `where` removed
|
756
|
+
bind values used by the `or` instead. (possibly other cases too)
|
757
|
+
|
758
|
+
```
|
759
|
+
Post.where(id: 1).or(Post.where(id: 2)).where(foo: 3).unscope(where: :foo).to_sql
|
760
|
+
# Currently:
|
761
|
+
# SELECT "posts".* FROM "posts" WHERE ("posts"."id" = 2 OR "posts"."id" = 3)
|
762
|
+
# With fix:
|
763
|
+
# SELECT "posts".* FROM "posts" WHERE ("posts"."id" = 1 OR "posts"."id" = 2)
|
764
|
+
```
|
765
|
+
|
766
|
+
*Maxime Handfield Lapointe*
|
767
|
+
|
768
|
+
* Values constructed using multi-parameter assignment will now use the
|
769
|
+
post-type-cast value for rendering in single-field form inputs.
|
770
|
+
|
771
|
+
*Sean Griffin*
|
772
|
+
|
773
|
+
* `Relation#joins` is no longer affected by the target model's
|
774
|
+
`current_scope`, with the exception of `unscoped`.
|
775
|
+
|
776
|
+
Fixes #29338.
|
777
|
+
|
778
|
+
*Sean Griffin*
|
779
|
+
|
780
|
+
* Change sqlite3 boolean serialization to use 1 and 0.
|
781
|
+
|
782
|
+
SQLite natively recognizes 1 and 0 as true and false, but does not natively
|
783
|
+
recognize 't' and 'f' as was previously serialized.
|
784
|
+
|
785
|
+
This change in serialization requires a migration of stored boolean data
|
786
|
+
for SQLite databases, so it's implemented behind a configuration flag
|
787
|
+
whose default false value is deprecated.
|
788
|
+
|
789
|
+
*Lisa Ugray*
|
790
|
+
|
791
|
+
* Skip query caching when working with batches of records (`find_each`, `find_in_batches`,
|
792
|
+
`in_batches`).
|
793
|
+
|
794
|
+
Previously, records would be fetched in batches, but all records would be retained in memory
|
795
|
+
until the end of the request or job.
|
796
|
+
|
797
|
+
*Eugene Kenny*
|
798
|
+
|
799
|
+
* Prevent errors raised by `sql.active_record` notification subscribers from being converted into
|
800
|
+
`ActiveRecord::StatementInvalid` exceptions.
|
801
|
+
|
802
|
+
*Dennis Taylor*
|
803
|
+
|
804
|
+
* Fix eager loading/preloading association with scope including joins.
|
805
|
+
|
806
|
+
Fixes #28324.
|
807
|
+
|
808
|
+
*Ryuta Kamizono*
|
809
|
+
|
810
|
+
* Fix transactions to apply state to child transactions.
|
811
|
+
|
812
|
+
Previously, if you had a nested transaction and the outer transaction was rolledback, the record from the
|
813
|
+
inner transaction would still be marked as persisted.
|
814
|
+
|
815
|
+
This change fixes that by applying the state of the parent transaction to the child transaction when the
|
816
|
+
parent transaction is rolledback. This will correctly mark records from the inner transaction as not persisted.
|
817
|
+
|
818
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
819
|
+
|
820
|
+
* Deprecate `set_state` method in `TransactionState`.
|
821
|
+
|
822
|
+
Deprecated the `set_state` method in favor of setting the state via specific methods. If you need to mark the
|
823
|
+
state of the transaction you can now use `rollback!`, `commit!` or `nullify!` instead of
|
824
|
+
`set_state(:rolledback)`, `set_state(:committed)`, or `set_state(nil)`.
|
825
|
+
|
826
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
827
|
+
|
828
|
+
* Deprecate delegating to `arel` in `Relation`.
|
829
|
+
|
830
|
+
*Ryuta Kamizono*
|
831
|
+
|
832
|
+
* Query cache was unavailable when entering the `ActiveRecord::Base.cache` block
|
833
|
+
without being connected.
|
834
|
+
|
835
|
+
*Tsukasa Oishi*
|
836
|
+
|
837
|
+
* Previously, when building records using a `has_many :through` association,
|
838
|
+
if the child records were deleted before the parent was saved, they would
|
839
|
+
still be persisted. Now, if child records are deleted before the parent is saved
|
840
|
+
on a `has_many :through` association, the child records will not be persisted.
|
841
|
+
|
842
|
+
*Tobias Kraze*
|
843
|
+
|
844
|
+
* Merging two relations representing nested joins no longer transforms the joins of
|
845
|
+
the merged relation into LEFT OUTER JOIN.
|
846
|
+
|
847
|
+
Example:
|
848
|
+
|
849
|
+
```
|
850
|
+
Author.joins(:posts).merge(Post.joins(:comments))
|
851
|
+
# Before the change:
|
852
|
+
#=> SELECT ... FROM authors INNER JOIN posts ON ... LEFT OUTER JOIN comments ON...
|
853
|
+
|
854
|
+
# After the change:
|
855
|
+
#=> SELECT ... FROM authors INNER JOIN posts ON ... INNER JOIN comments ON...
|
856
|
+
```
|
857
|
+
|
858
|
+
*Maxime Handfield Lapointe*
|
859
|
+
|
860
|
+
* `ActiveRecord::Persistence#touch` does not work well when optimistic locking enabled and
|
861
|
+
`locking_column`, without default value, is null in the database.
|
862
|
+
|
863
|
+
*bogdanvlviv*
|
864
|
+
|
865
|
+
* Fix destroying existing object does not work well when optimistic locking enabled and
|
866
|
+
`locking_column` is null in the database.
|
867
|
+
|
868
|
+
*bogdanvlviv*
|
869
|
+
|
870
|
+
* Use bulk INSERT to insert fixtures for better performance.
|
871
|
+
|
872
|
+
*Kir Shatrov*
|
873
|
+
|
874
|
+
* Prevent creation of bind param if casted value is nil.
|
875
|
+
|
876
|
+
*Ryuta Kamizono*
|
877
|
+
|
878
|
+
* Deprecate passing arguments and block at the same time to `count` and `sum` in `ActiveRecord::Calculations`.
|
879
|
+
|
880
|
+
*Ryuta Kamizono*
|
881
|
+
|
882
|
+
* Loading model schema from database is now thread-safe.
|
883
|
+
|
884
|
+
Fixes #28589.
|
885
|
+
|
886
|
+
*Vikrant Chaudhary*, *David Abdemoulaie*
|
887
|
+
|
888
|
+
* Add `ActiveRecord::Base#cache_version` to support recyclable cache keys via the new versioned entries
|
889
|
+
in `ActiveSupport::Cache`. This also means that `ActiveRecord::Base#cache_key` will now return a stable key
|
890
|
+
that does not include a timestamp any more.
|
891
|
+
|
892
|
+
NOTE: This feature is turned off by default, and `#cache_key` will still return cache keys with timestamps
|
893
|
+
until you set `ActiveRecord::Base.cache_versioning = true`. That's the setting for all new apps on Rails 5.2+
|
894
|
+
|
895
|
+
*DHH*
|
896
|
+
|
897
|
+
* Respect `SchemaDumper.ignore_tables` in rake tasks for databases structure dump.
|
898
|
+
|
899
|
+
*Rusty Geldmacher*, *Guillermo Iguaran*
|
900
|
+
|
901
|
+
* Add type caster to `RuntimeReflection#alias_name`.
|
902
|
+
|
903
|
+
Fixes #28959.
|
904
|
+
|
905
|
+
*Jon Moss*
|
906
|
+
|
907
|
+
* Deprecate `supports_statement_cache?`.
|
908
|
+
|
909
|
+
*Ryuta Kamizono*
|
910
|
+
|
911
|
+
* Raise error `UnknownMigrationVersionError` on the movement of migrations
|
912
|
+
when the current migration does not exist.
|
913
|
+
|
914
|
+
*bogdanvlviv*
|
915
|
+
|
916
|
+
* Fix `bin/rails db:forward` first migration.
|
917
|
+
|
918
|
+
*bogdanvlviv*
|
919
|
+
|
920
|
+
* Support Descending Indexes for MySQL.
|
921
|
+
|
922
|
+
MySQL 8.0.1 and higher supports descending indexes: `DESC` in an index definition is no longer ignored.
|
923
|
+
See https://dev.mysql.com/doc/refman/8.0/en/descending-indexes.html.
|
924
|
+
|
925
|
+
*Ryuta Kamizono*
|
926
|
+
|
927
|
+
* Fix inconsistency with changed attributes when overriding Active Record attribute reader.
|
928
|
+
|
929
|
+
*bogdanvlviv*
|
930
|
+
|
931
|
+
* When calling the dynamic fixture accessor method with no arguments, it now returns all fixtures of this type.
|
932
|
+
Previously this method always returned an empty array.
|
933
|
+
|
934
|
+
*Kevin McPhillips*
|
935
|
+
|
936
|
+
|
937
|
+
Please check [5-1-stable](https://github.com/rails/rails/blob/5-1-stable/activerecord/CHANGELOG.md) for previous changes.
|