activerecord 5.0.7.2 → 6.1.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activerecord might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +829 -2015
- data/MIT-LICENSE +3 -1
- data/README.rdoc +11 -9
- data/examples/performance.rb +31 -29
- data/examples/simple.rb +5 -3
- data/lib/active_record.rb +37 -29
- data/lib/active_record/aggregations.rb +249 -247
- data/lib/active_record/association_relation.rb +30 -18
- data/lib/active_record/associations.rb +1714 -1596
- data/lib/active_record/associations/alias_tracker.rb +36 -42
- data/lib/active_record/associations/association.rb +143 -68
- data/lib/active_record/associations/association_scope.rb +98 -94
- data/lib/active_record/associations/belongs_to_association.rb +76 -46
- data/lib/active_record/associations/belongs_to_polymorphic_association.rb +13 -12
- data/lib/active_record/associations/builder/association.rb +27 -28
- data/lib/active_record/associations/builder/belongs_to.rb +52 -60
- data/lib/active_record/associations/builder/collection_association.rb +12 -22
- data/lib/active_record/associations/builder/has_and_belongs_to_many.rb +40 -62
- data/lib/active_record/associations/builder/has_many.rb +10 -2
- data/lib/active_record/associations/builder/has_one.rb +35 -2
- data/lib/active_record/associations/builder/singular_association.rb +5 -1
- data/lib/active_record/associations/collection_association.rb +104 -259
- data/lib/active_record/associations/collection_proxy.rb +169 -125
- data/lib/active_record/associations/foreign_association.rb +22 -0
- data/lib/active_record/associations/has_many_association.rb +46 -31
- data/lib/active_record/associations/has_many_through_association.rb +66 -46
- data/lib/active_record/associations/has_one_association.rb +71 -52
- data/lib/active_record/associations/has_one_through_association.rb +20 -11
- data/lib/active_record/associations/join_dependency.rb +169 -180
- data/lib/active_record/associations/join_dependency/join_association.rb +53 -79
- data/lib/active_record/associations/join_dependency/join_base.rb +10 -9
- data/lib/active_record/associations/join_dependency/join_part.rb +14 -14
- data/lib/active_record/associations/preloader.rb +97 -104
- data/lib/active_record/associations/preloader/association.rb +109 -97
- data/lib/active_record/associations/preloader/through_association.rb +77 -76
- data/lib/active_record/associations/singular_association.rb +12 -45
- data/lib/active_record/associations/through_association.rb +27 -15
- data/lib/active_record/attribute_assignment.rb +55 -60
- data/lib/active_record/attribute_methods.rb +111 -141
- data/lib/active_record/attribute_methods/before_type_cast.rb +17 -9
- data/lib/active_record/attribute_methods/dirty.rb +172 -112
- data/lib/active_record/attribute_methods/primary_key.rb +88 -91
- data/lib/active_record/attribute_methods/query.rb +6 -8
- data/lib/active_record/attribute_methods/read.rb +18 -50
- data/lib/active_record/attribute_methods/serialization.rb +38 -10
- data/lib/active_record/attribute_methods/time_zone_conversion.rb +38 -66
- data/lib/active_record/attribute_methods/write.rb +25 -32
- data/lib/active_record/attributes.rb +69 -31
- data/lib/active_record/autosave_association.rb +102 -66
- data/lib/active_record/base.rb +16 -25
- data/lib/active_record/callbacks.rb +202 -43
- data/lib/active_record/coders/json.rb +2 -0
- data/lib/active_record/coders/yaml_column.rb +11 -12
- data/lib/active_record/connection_adapters.rb +50 -0
- data/lib/active_record/connection_adapters/abstract/connection_pool.rb +661 -375
- data/lib/active_record/connection_adapters/abstract/database_limits.rb +14 -38
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +269 -105
- data/lib/active_record/connection_adapters/abstract/query_cache.rb +54 -35
- data/lib/active_record/connection_adapters/abstract/quoting.rb +137 -93
- data/lib/active_record/connection_adapters/abstract/savepoints.rb +5 -3
- data/lib/active_record/connection_adapters/abstract/schema_creation.rb +155 -113
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +328 -162
- data/lib/active_record/connection_adapters/abstract/schema_dumper.rb +68 -80
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +591 -259
- data/lib/active_record/connection_adapters/abstract/transaction.rb +229 -91
- data/lib/active_record/connection_adapters/abstract_adapter.rb +392 -244
- data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +457 -582
- data/lib/active_record/connection_adapters/column.rb +55 -13
- data/lib/active_record/connection_adapters/deduplicable.rb +29 -0
- data/lib/active_record/connection_adapters/legacy_pool_manager.rb +31 -0
- data/lib/active_record/connection_adapters/mysql/column.rb +8 -31
- data/lib/active_record/connection_adapters/mysql/database_statements.rb +135 -49
- data/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb +24 -23
- data/lib/active_record/connection_adapters/mysql/quoting.rb +50 -20
- data/lib/active_record/connection_adapters/mysql/schema_creation.rb +79 -49
- data/lib/active_record/connection_adapters/mysql/schema_definitions.rb +66 -56
- data/lib/active_record/connection_adapters/mysql/schema_dumper.rb +70 -36
- data/lib/active_record/connection_adapters/mysql/schema_statements.rb +268 -0
- data/lib/active_record/connection_adapters/mysql/type_metadata.rb +20 -12
- data/lib/active_record/connection_adapters/mysql2_adapter.rb +74 -37
- data/lib/active_record/connection_adapters/pool_config.rb +63 -0
- data/lib/active_record/connection_adapters/pool_manager.rb +43 -0
- data/lib/active_record/connection_adapters/postgresql/column.rb +39 -28
- data/lib/active_record/connection_adapters/postgresql/database_statements.rb +70 -101
- data/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb +5 -3
- data/lib/active_record/connection_adapters/postgresql/oid.rb +26 -21
- data/lib/active_record/connection_adapters/postgresql/oid/array.rb +22 -11
- data/lib/active_record/connection_adapters/postgresql/oid/bit.rb +6 -5
- data/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb +2 -0
- data/lib/active_record/connection_adapters/postgresql/oid/bytea.rb +2 -0
- data/lib/active_record/connection_adapters/postgresql/oid/cidr.rb +6 -6
- data/lib/active_record/connection_adapters/postgresql/oid/date.rb +23 -0
- data/lib/active_record/connection_adapters/postgresql/oid/date_time.rb +14 -4
- data/lib/active_record/connection_adapters/postgresql/oid/decimal.rb +3 -1
- data/lib/active_record/connection_adapters/postgresql/oid/enum.rb +5 -4
- data/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +19 -18
- data/lib/active_record/connection_adapters/postgresql/oid/inet.rb +2 -0
- data/lib/active_record/connection_adapters/postgresql/oid/interval.rb +49 -0
- data/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb +3 -11
- data/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb +44 -0
- data/lib/active_record/connection_adapters/postgresql/oid/macaddr.rb +25 -0
- data/lib/active_record/connection_adapters/postgresql/oid/money.rb +7 -5
- data/lib/active_record/connection_adapters/postgresql/oid/{json.rb → oid.rb} +6 -1
- data/lib/active_record/connection_adapters/postgresql/oid/point.rb +30 -9
- data/lib/active_record/connection_adapters/postgresql/oid/range.rb +52 -30
- data/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb +4 -1
- data/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb +58 -54
- data/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +18 -4
- data/lib/active_record/connection_adapters/postgresql/oid/vector.rb +2 -0
- data/lib/active_record/connection_adapters/postgresql/oid/xml.rb +2 -0
- data/lib/active_record/connection_adapters/postgresql/quoting.rb +98 -38
- data/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +21 -27
- data/lib/active_record/connection_adapters/postgresql/schema_creation.rb +80 -0
- data/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +147 -105
- data/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +34 -32
- data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +426 -324
- data/lib/active_record/connection_adapters/postgresql/type_metadata.rb +32 -23
- data/lib/active_record/connection_adapters/postgresql/utils.rb +9 -6
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +418 -293
- data/lib/active_record/connection_adapters/schema_cache.rb +135 -18
- data/lib/active_record/connection_adapters/sql_type_metadata.rb +22 -7
- data/lib/active_record/connection_adapters/sqlite3/database_statements.rb +144 -0
- data/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb +3 -1
- data/lib/active_record/connection_adapters/sqlite3/quoting.rb +72 -18
- data/lib/active_record/connection_adapters/sqlite3/schema_creation.rb +5 -6
- 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 +170 -0
- data/lib/active_record/connection_adapters/sqlite3_adapter.rb +282 -290
- data/lib/active_record/connection_adapters/statement_pool.rb +9 -8
- data/lib/active_record/connection_handling.rb +287 -45
- data/lib/active_record/core.rb +385 -181
- data/lib/active_record/counter_cache.rb +60 -28
- data/lib/active_record/database_configurations.rb +272 -0
- data/lib/active_record/database_configurations/connection_url_resolver.rb +98 -0
- data/lib/active_record/database_configurations/database_config.rb +80 -0
- data/lib/active_record/database_configurations/hash_config.rb +96 -0
- data/lib/active_record/database_configurations/url_config.rb +53 -0
- data/lib/active_record/delegated_type.rb +209 -0
- data/lib/active_record/destroy_association_async_job.rb +36 -0
- data/lib/active_record/dynamic_matchers.rb +87 -87
- data/lib/active_record/enum.rb +122 -47
- data/lib/active_record/errors.rb +153 -22
- data/lib/active_record/explain.rb +13 -8
- data/lib/active_record/explain_registry.rb +3 -1
- data/lib/active_record/explain_subscriber.rb +9 -4
- data/lib/active_record/fixture_set/file.rb +20 -22
- data/lib/active_record/fixture_set/model_metadata.rb +32 -0
- data/lib/active_record/fixture_set/render_context.rb +17 -0
- data/lib/active_record/fixture_set/table_row.rb +152 -0
- data/lib/active_record/fixture_set/table_rows.rb +46 -0
- data/lib/active_record/fixtures.rb +246 -507
- data/lib/active_record/gem_version.rb +6 -4
- data/lib/active_record/inheritance.rb +168 -95
- data/lib/active_record/insert_all.rb +208 -0
- data/lib/active_record/integration.rb +114 -25
- data/lib/active_record/internal_metadata.rb +30 -24
- data/lib/active_record/legacy_yaml_adapter.rb +11 -5
- data/lib/active_record/locking/optimistic.rb +81 -85
- data/lib/active_record/locking/pessimistic.rb +22 -6
- data/lib/active_record/log_subscriber.rb +68 -31
- data/lib/active_record/middleware/database_selector.rb +77 -0
- data/lib/active_record/middleware/database_selector/resolver.rb +92 -0
- data/lib/active_record/middleware/database_selector/resolver/session.rb +48 -0
- data/lib/active_record/migration.rb +439 -342
- data/lib/active_record/migration/command_recorder.rb +152 -98
- data/lib/active_record/migration/compatibility.rb +229 -60
- data/lib/active_record/migration/join_table.rb +8 -7
- data/lib/active_record/model_schema.rb +230 -122
- data/lib/active_record/nested_attributes.rb +213 -203
- data/lib/active_record/no_touching.rb +11 -2
- data/lib/active_record/null_relation.rb +12 -34
- data/lib/active_record/persistence.rb +471 -97
- data/lib/active_record/query_cache.rb +23 -12
- data/lib/active_record/querying.rb +43 -25
- data/lib/active_record/railtie.rb +155 -43
- data/lib/active_record/railties/console_sandbox.rb +2 -0
- data/lib/active_record/railties/controller_runtime.rb +34 -33
- data/lib/active_record/railties/databases.rake +507 -195
- data/lib/active_record/readonly_attributes.rb +9 -4
- data/lib/active_record/reflection.rb +245 -269
- data/lib/active_record/relation.rb +475 -324
- data/lib/active_record/relation/batches.rb +125 -72
- data/lib/active_record/relation/batches/batch_enumerator.rb +28 -10
- data/lib/active_record/relation/calculations.rb +267 -171
- data/lib/active_record/relation/delegation.rb +73 -69
- data/lib/active_record/relation/finder_methods.rb +238 -248
- data/lib/active_record/relation/from_clause.rb +7 -9
- data/lib/active_record/relation/merger.rb +95 -77
- data/lib/active_record/relation/predicate_builder.rb +109 -110
- data/lib/active_record/relation/predicate_builder/array_handler.rb +22 -17
- data/lib/active_record/relation/predicate_builder/association_query_value.rb +42 -0
- data/lib/active_record/relation/predicate_builder/basic_object_handler.rb +6 -4
- data/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb +55 -0
- data/lib/active_record/relation/predicate_builder/range_handler.rb +7 -18
- data/lib/active_record/relation/predicate_builder/relation_handler.rb +7 -1
- data/lib/active_record/relation/query_attribute.rb +33 -2
- data/lib/active_record/relation/query_methods.rb +654 -374
- data/lib/active_record/relation/record_fetch_warning.rb +8 -6
- data/lib/active_record/relation/spawn_methods.rb +15 -14
- data/lib/active_record/relation/where_clause.rb +171 -109
- data/lib/active_record/result.rb +88 -51
- data/lib/active_record/runtime_registry.rb +5 -3
- data/lib/active_record/sanitization.rb +73 -100
- data/lib/active_record/schema.rb +7 -14
- data/lib/active_record/schema_dumper.rb +101 -69
- data/lib/active_record/schema_migration.rb +16 -12
- data/lib/active_record/scoping.rb +20 -20
- data/lib/active_record/scoping/default.rb +92 -95
- data/lib/active_record/scoping/named.rb +39 -30
- data/lib/active_record/secure_token.rb +19 -9
- data/lib/active_record/serialization.rb +7 -3
- data/lib/active_record/signed_id.rb +116 -0
- data/lib/active_record/statement_cache.rb +80 -29
- data/lib/active_record/store.rb +122 -42
- data/lib/active_record/suppressor.rb +6 -3
- data/lib/active_record/table_metadata.rb +51 -39
- data/lib/active_record/tasks/database_tasks.rb +332 -115
- data/lib/active_record/tasks/mysql_database_tasks.rb +66 -104
- data/lib/active_record/tasks/postgresql_database_tasks.rb +84 -56
- data/lib/active_record/tasks/sqlite_database_tasks.rb +40 -19
- data/lib/active_record/test_databases.rb +24 -0
- data/lib/active_record/test_fixtures.rb +246 -0
- data/lib/active_record/timestamp.rb +70 -38
- data/lib/active_record/touch_later.rb +26 -24
- data/lib/active_record/transactions.rb +121 -184
- data/lib/active_record/translation.rb +3 -1
- data/lib/active_record/type.rb +29 -17
- data/lib/active_record/type/adapter_specific_registry.rb +44 -48
- data/lib/active_record/type/date.rb +2 -0
- data/lib/active_record/type/date_time.rb +2 -0
- data/lib/active_record/type/decimal_without_scale.rb +15 -0
- data/lib/active_record/type/hash_lookup_type_map.rb +5 -4
- data/lib/active_record/type/internal/timezone.rb +2 -0
- data/lib/active_record/type/json.rb +30 -0
- data/lib/active_record/type/serialized.rb +20 -9
- data/lib/active_record/type/text.rb +11 -0
- data/lib/active_record/type/time.rb +12 -1
- data/lib/active_record/type/type_map.rb +14 -17
- data/lib/active_record/type/unsigned_integer.rb +16 -0
- data/lib/active_record/type_caster.rb +4 -2
- data/lib/active_record/type_caster/connection.rb +17 -13
- data/lib/active_record/type_caster/map.rb +10 -6
- data/lib/active_record/validations.rb +8 -5
- data/lib/active_record/validations/absence.rb +2 -0
- data/lib/active_record/validations/associated.rb +4 -3
- data/lib/active_record/validations/length.rb +2 -0
- data/lib/active_record/validations/numericality.rb +35 -0
- data/lib/active_record/validations/presence.rb +4 -2
- data/lib/active_record/validations/uniqueness.rb +52 -45
- data/lib/active_record/version.rb +3 -1
- data/lib/arel.rb +54 -0
- data/lib/arel/alias_predication.rb +9 -0
- data/lib/arel/attributes/attribute.rb +41 -0
- data/lib/arel/collectors/bind.rb +29 -0
- data/lib/arel/collectors/composite.rb +39 -0
- data/lib/arel/collectors/plain_string.rb +20 -0
- data/lib/arel/collectors/sql_string.rb +27 -0
- data/lib/arel/collectors/substitute_binds.rb +35 -0
- data/lib/arel/crud.rb +42 -0
- data/lib/arel/delete_manager.rb +18 -0
- data/lib/arel/errors.rb +9 -0
- data/lib/arel/expressions.rb +29 -0
- data/lib/arel/factory_methods.rb +49 -0
- data/lib/arel/insert_manager.rb +49 -0
- data/lib/arel/math.rb +45 -0
- data/lib/arel/nodes.rb +70 -0
- data/lib/arel/nodes/and.rb +32 -0
- data/lib/arel/nodes/ascending.rb +23 -0
- data/lib/arel/nodes/binary.rb +126 -0
- data/lib/arel/nodes/bind_param.rb +44 -0
- data/lib/arel/nodes/case.rb +55 -0
- data/lib/arel/nodes/casted.rb +62 -0
- data/lib/arel/nodes/comment.rb +29 -0
- data/lib/arel/nodes/count.rb +12 -0
- data/lib/arel/nodes/delete_statement.rb +45 -0
- data/lib/arel/nodes/descending.rb +23 -0
- data/lib/arel/nodes/equality.rb +15 -0
- data/lib/arel/nodes/extract.rb +24 -0
- data/lib/arel/nodes/false.rb +16 -0
- data/lib/arel/nodes/full_outer_join.rb +8 -0
- data/lib/arel/nodes/function.rb +44 -0
- data/lib/arel/nodes/grouping.rb +11 -0
- data/lib/arel/nodes/homogeneous_in.rb +72 -0
- data/lib/arel/nodes/in.rb +15 -0
- data/lib/arel/nodes/infix_operation.rb +92 -0
- data/lib/arel/nodes/inner_join.rb +8 -0
- data/lib/arel/nodes/insert_statement.rb +37 -0
- data/lib/arel/nodes/join_source.rb +20 -0
- data/lib/arel/nodes/matches.rb +18 -0
- data/lib/arel/nodes/named_function.rb +23 -0
- data/lib/arel/nodes/node.rb +51 -0
- data/lib/arel/nodes/node_expression.rb +13 -0
- data/lib/arel/nodes/ordering.rb +27 -0
- data/lib/arel/nodes/outer_join.rb +8 -0
- data/lib/arel/nodes/over.rb +15 -0
- data/lib/arel/nodes/regexp.rb +16 -0
- data/lib/arel/nodes/right_outer_join.rb +8 -0
- data/lib/arel/nodes/select_core.rb +67 -0
- data/lib/arel/nodes/select_statement.rb +41 -0
- data/lib/arel/nodes/sql_literal.rb +19 -0
- data/lib/arel/nodes/string_join.rb +11 -0
- data/lib/arel/nodes/table_alias.rb +31 -0
- data/lib/arel/nodes/terminal.rb +16 -0
- data/lib/arel/nodes/true.rb +16 -0
- data/lib/arel/nodes/unary.rb +44 -0
- data/lib/arel/nodes/unary_operation.rb +20 -0
- data/lib/arel/nodes/unqualified_column.rb +22 -0
- data/lib/arel/nodes/update_statement.rb +41 -0
- data/lib/arel/nodes/values_list.rb +9 -0
- data/lib/arel/nodes/window.rb +126 -0
- data/lib/arel/nodes/with.rb +11 -0
- data/lib/arel/order_predications.rb +13 -0
- data/lib/arel/predications.rb +250 -0
- data/lib/arel/select_manager.rb +270 -0
- data/lib/arel/table.rb +118 -0
- data/lib/arel/tree_manager.rb +72 -0
- data/lib/arel/update_manager.rb +34 -0
- data/lib/arel/visitors.rb +13 -0
- data/lib/arel/visitors/dot.rb +308 -0
- data/lib/arel/visitors/mysql.rb +93 -0
- data/lib/arel/visitors/postgresql.rb +120 -0
- data/lib/arel/visitors/sqlite.rb +38 -0
- data/lib/arel/visitors/to_sql.rb +899 -0
- data/lib/arel/visitors/visitor.rb +45 -0
- data/lib/arel/window_predications.rb +9 -0
- data/lib/rails/generators/active_record.rb +7 -5
- data/lib/rails/generators/active_record/application_record/application_record_generator.rb +26 -0
- data/lib/rails/generators/active_record/{model/templates/application_record.rb → application_record/templates/application_record.rb.tt} +0 -0
- data/lib/rails/generators/active_record/migration.rb +22 -3
- data/lib/rails/generators/active_record/migration/migration_generator.rb +38 -35
- data/lib/rails/generators/active_record/migration/templates/{create_table_migration.rb → create_table_migration.rb.tt} +3 -1
- data/lib/rails/generators/active_record/migration/templates/{migration.rb → migration.rb.tt} +7 -5
- data/lib/rails/generators/active_record/model/model_generator.rb +41 -25
- data/lib/rails/generators/active_record/model/templates/abstract_base_class.rb.tt +7 -0
- data/lib/rails/generators/active_record/model/templates/{model.rb → model.rb.tt} +10 -1
- data/lib/rails/generators/active_record/model/templates/{module.rb → module.rb.tt} +0 -0
- metadata +141 -57
- data/lib/active_record/associations/preloader/belongs_to.rb +0 -17
- data/lib/active_record/associations/preloader/collection_association.rb +0 -17
- 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 -15
- data/lib/active_record/associations/preloader/has_one_through.rb +0 -9
- data/lib/active_record/associations/preloader/singular_association.rb +0 -20
- data/lib/active_record/attribute.rb +0 -213
- data/lib/active_record/attribute/user_provided_default.rb +0 -28
- data/lib/active_record/attribute_decorators.rb +0 -67
- data/lib/active_record/attribute_mutation_tracker.rb +0 -70
- data/lib/active_record/attribute_set.rb +0 -110
- data/lib/active_record/attribute_set/builder.rb +0 -132
- data/lib/active_record/collection_cache_key.rb +0 -50
- data/lib/active_record/connection_adapters/connection_specification.rb +0 -263
- data/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb +0 -22
- data/lib/active_record/connection_adapters/postgresql/oid/rails_5_1_point.rb +0 -50
- data/lib/active_record/railties/jdbcmysql_error.rb +0 -16
- data/lib/active_record/relation/predicate_builder/association_query_handler.rb +0 -88
- data/lib/active_record/relation/predicate_builder/base_handler.rb +0 -17
- data/lib/active_record/relation/predicate_builder/class_handler.rb +0 -27
- data/lib/active_record/relation/predicate_builder/polymorphic_array_handler.rb +0 -57
- data/lib/active_record/relation/where_clause_factory.rb +0 -38
- data/lib/active_record/type/internal/abstract_json.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56f128436e13685f9715b6dbe295150f61a11e7af686fc5d758044f080fe1879
|
4
|
+
data.tar.gz: b80991c1de4020e4e770f64464683e6e3cd88f38dbc93e8909c270ade9f32d20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10f8bd5fccf212ad4807ae6c08a8264333af73373606dce2eb2338e2f6edcfa7469351f5a905836e4be6764548e580d0c205564c8aa2493cbb1476f02ed555a4
|
7
|
+
data.tar.gz: 2ff2988d43a99595a0a14d796afeca8aa53b54a8f7e516721a026a053cdc7bb0c23fcf934d180a165023b58c5e9335d42bb1c0e0b9daf1b6df078c1e969fc8c1
|
data/CHANGELOG.md
CHANGED
@@ -1,2549 +1,1363 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 6.1.1 (January 07, 2021) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* Fix fixtures loading when strict loading is enabled for the association.
|
4
4
|
|
5
|
+
*Alex Ghiculescu*
|
5
6
|
|
6
|
-
|
7
|
+
* Fix `where` with custom primary key for belongs_to association.
|
7
8
|
|
8
|
-
*
|
9
|
-
|
10
|
-
|
11
|
-
## Rails 5.0.7 (March 29, 2018) ##
|
12
|
-
|
13
|
-
* Apply time column precision on assignment.
|
14
|
-
|
15
|
-
PR #20317 changed the behavior of datetime columns so that when they
|
16
|
-
have a specified precision then on assignment the value is rounded to
|
17
|
-
that precision. This behavior is now applied to time columns as well.
|
18
|
-
|
19
|
-
Fixes #30301.
|
20
|
-
|
21
|
-
*Andrew White*
|
22
|
-
|
23
|
-
* Normalize time column values for SQLite database.
|
24
|
-
|
25
|
-
For legacy reasons, time columns in SQLite are stored as full datetimes
|
26
|
-
because until #24542 the quoting for time columns didn't remove the date
|
27
|
-
component. To ensure that values are consistent we now normalize the
|
28
|
-
date component to 2001-01-01 on reading and writing.
|
29
|
-
|
30
|
-
*Andrew White*
|
31
|
-
|
32
|
-
* Ensure that the date component is removed when quoting times.
|
33
|
-
|
34
|
-
PR #24542 altered the quoting for time columns so that the date component
|
35
|
-
was removed however it only removed it when it was 2001-01-01. Now the
|
36
|
-
date component is removed irrespective of what the date is.
|
37
|
-
|
38
|
-
*Andrew White*
|
39
|
-
|
40
|
-
* Query cache was unavailable when entering the `ActiveRecord::Base.cache` block
|
41
|
-
without being connected.
|
42
|
-
|
43
|
-
*Tsukasa Oishi*
|
9
|
+
*Ryuta Kamizono*
|
44
10
|
|
45
|
-
* Fix `
|
46
|
-
ar_internal_metadata's data for a test database.
|
11
|
+
* Fix `where` with aliased associations.
|
47
12
|
|
48
|
-
|
49
|
-
```
|
50
|
-
$ RAILS_ENV=test rails dbconsole
|
51
|
-
> SELECT * FROM ar_internal_metadata;
|
52
|
-
key|value|created_at|updated_at
|
53
|
-
environment|development|2017-09-11 23:14:10.815679|2017-09-11 23:14:10.815679
|
54
|
-
```
|
13
|
+
*Ryuta Kamizono*
|
55
14
|
|
56
|
-
|
57
|
-
```
|
58
|
-
$ RAILS_ENV=test rails dbconsole
|
59
|
-
> SELECT * FROM ar_internal_metadata;
|
60
|
-
key|value|created_at|updated_at
|
61
|
-
environment|test|2017-09-11 23:14:10.815679|2017-09-11 23:14:10.815679
|
62
|
-
```
|
15
|
+
* Fix `composed_of` with symbol mapping.
|
63
16
|
|
64
|
-
|
17
|
+
*Ryuta Kamizono*
|
65
18
|
|
66
|
-
|
19
|
+
* Don't skip money's type cast for pluck and calculations.
|
67
20
|
|
68
|
-
*
|
21
|
+
*Ryuta Kamizono*
|
69
22
|
|
70
|
-
|
23
|
+
* Fix `where` on polymorphic association with non Active Record object.
|
71
24
|
|
72
25
|
*Ryuta Kamizono*
|
73
26
|
|
74
|
-
*
|
27
|
+
* Make sure `db:prepare` works even the schema file doesn't exist.
|
75
28
|
|
76
|
-
*
|
29
|
+
*Rafael Mendonça França*
|
77
30
|
|
31
|
+
* Fix complicated `has_many :through` with nested where condition.
|
78
32
|
|
79
|
-
|
33
|
+
*Ryuta Kamizono*
|
80
34
|
|
81
|
-
*
|
35
|
+
* Handle STI models for `has_many dependent: :destroy_async`.
|
82
36
|
|
37
|
+
*Muhammad Usman*
|
83
38
|
|
84
|
-
|
39
|
+
* Restore possibility of passing `false` to :polymorphic option of `belongs_to`.
|
85
40
|
|
86
|
-
|
41
|
+
Previously, passing `false` would trigger the option validation logic
|
42
|
+
to throw an error saying :polymorphic would not be a valid option.
|
87
43
|
|
88
|
-
|
44
|
+
*glaszig*
|
89
45
|
|
90
|
-
|
46
|
+
* Allow adding nonnamed expression indexes to be revertible.
|
91
47
|
|
48
|
+
Fixes #40732.
|
92
49
|
|
93
|
-
|
50
|
+
Previously, the following code would raise an error, when executed while rolling back,
|
51
|
+
and the index name should be specified explicitly. Now, the index name is inferred
|
52
|
+
automatically.
|
94
53
|
|
95
|
-
|
54
|
+
```ruby
|
55
|
+
add_index(:items, "to_tsvector('english', description)")
|
56
|
+
```
|
96
57
|
|
58
|
+
*fatkodima*
|
97
59
|
|
98
|
-
## Rails 5.0.5.rc2 (July 25, 2017) ##
|
99
60
|
|
100
|
-
|
61
|
+
## Rails 6.1.0 (December 09, 2020) ##
|
101
62
|
|
63
|
+
* Only warn about negative enums if a positive form that would cause conflicts exists.
|
102
64
|
|
103
|
-
|
65
|
+
Fixes #39065.
|
104
66
|
|
105
|
-
*
|
106
|
-
`current_scope`, with the exception of `unscoped`.
|
67
|
+
*Alex Ghiculescu*
|
107
68
|
|
108
|
-
|
69
|
+
* Change `attribute_for_inspect` to take `filter_attributes` in consideration.
|
109
70
|
|
110
|
-
*
|
71
|
+
*Rafael Mendonça França*
|
111
72
|
|
73
|
+
* Fix odd behavior of inverse_of with multiple belongs_to to same class.
|
112
74
|
|
113
|
-
|
75
|
+
Fixes #35204.
|
114
76
|
|
115
|
-
*
|
116
|
-
methods stubbed, and they respect extension modules applied by a default
|
117
|
-
scope.
|
77
|
+
*Tomoyuki Kai*
|
118
78
|
|
119
|
-
|
79
|
+
* Build predicate conditions with objects that delegate `#id` and primary key:
|
120
80
|
|
121
|
-
|
81
|
+
```ruby
|
82
|
+
class AdminAuthor
|
83
|
+
delegate_missing_to :@author
|
122
84
|
|
123
|
-
|
85
|
+
def initialize(author)
|
86
|
+
@author = author
|
87
|
+
end
|
88
|
+
end
|
124
89
|
|
125
|
-
|
90
|
+
Post.where(author: AdminAuthor.new(author))
|
91
|
+
```
|
126
92
|
|
93
|
+
*Sean Doyle*
|
127
94
|
|
128
|
-
|
95
|
+
* Add `connected_to_many` API.
|
129
96
|
|
130
|
-
|
97
|
+
This API allows applications to connect to multiple databases at once without switching all of them or implementing a deeply nested stack.
|
131
98
|
|
132
|
-
|
133
|
-
path defined in `Rails.application.config.paths` however the code checked
|
134
|
-
for the presence of the `Rails` constant but not the `Rails.application`
|
135
|
-
method which caused problems when using Active Record and generators outside
|
136
|
-
of the context of a Rails application.
|
99
|
+
Before:
|
137
100
|
|
138
|
-
|
101
|
+
AnimalsRecord.connected_to(role: :reading) do
|
102
|
+
MealsRecord.connected_to(role: :reading) do
|
103
|
+
Dog.first # read from animals replica
|
104
|
+
Dinner.first # read from meals replica
|
105
|
+
Person.first # read from primary writer
|
106
|
+
end
|
107
|
+
end
|
139
108
|
|
140
|
-
|
109
|
+
After:
|
141
110
|
|
142
|
-
|
111
|
+
ActiveRecord::Base.connected_to_many([AnimalsRecord, MealsRecord], role: :reading) do
|
112
|
+
Dog.first # read from animals replica
|
113
|
+
Dinner.first # read from meals replica
|
114
|
+
Person.first # read from primary writer
|
115
|
+
end
|
143
116
|
|
144
|
-
*
|
117
|
+
*Eileen M. Uchitelle*, *John Crepezzi*
|
145
118
|
|
146
|
-
*
|
119
|
+
* Add option to raise or log for `ActiveRecord::StrictLoadingViolationError`.
|
147
120
|
|
148
|
-
|
121
|
+
Some applications may not want to raise an error in production if using `strict_loading`. This would allow an application to set strict loading to log for the production environment while still raising in development and test environments.
|
149
122
|
|
150
|
-
|
123
|
+
Set `config.active_record.action_on_strict_loading_violation` to `:log` errors instead of raising.
|
151
124
|
|
152
|
-
*
|
125
|
+
*Eileen M. Uchitelle*
|
153
126
|
|
154
|
-
*
|
127
|
+
* Allow the inverse of a `has_one` association that was previously autosaved to be loaded.
|
155
128
|
|
156
|
-
|
157
|
-
between the two columns doesn't make sense since they are different types.
|
158
|
-
The `reference_id` column is usually an integer and the `reference_type`
|
159
|
-
column a string so options like `unsigned: true` will result in an invalid
|
160
|
-
table definition.
|
129
|
+
Fixes #34255.
|
161
130
|
|
162
|
-
*
|
131
|
+
*Steven Weber*
|
163
132
|
|
164
|
-
*
|
133
|
+
* Optimise the length of index names for polymorphic references by using the reference name rather than the type and id column names.
|
165
134
|
|
166
|
-
|
135
|
+
Because the default behaviour when adding an index with multiple columns is to use all column names in the index name, this could frequently lead to overly long index names for polymorphic references which would fail the migration if it exceeded the database limit.
|
167
136
|
|
137
|
+
This change reduces the chance of that happening by using the reference name, e.g. `index_my_table_on_my_reference`.
|
168
138
|
|
169
|
-
|
139
|
+
Fixes #38655.
|
170
140
|
|
171
|
-
*
|
141
|
+
*Luke Redpath*
|
172
142
|
|
173
|
-
|
143
|
+
* MySQL: Uniqueness validator now respects default database collation,
|
144
|
+
no longer enforce case sensitive comparison by default.
|
174
145
|
|
175
146
|
*Ryuta Kamizono*
|
176
147
|
|
177
|
-
*
|
178
|
-
so queries are not run against the previous table name.
|
148
|
+
* Remove deprecated methods from `ActiveRecord::ConnectionAdapters::DatabaseLimits`.
|
179
149
|
|
180
|
-
|
150
|
+
`column_name_length`
|
151
|
+
`table_name_length`
|
152
|
+
`columns_per_table`
|
153
|
+
`indexes_per_table`
|
154
|
+
`columns_per_multicolumn_index`
|
155
|
+
`sql_query_length`
|
156
|
+
`joins_per_query`
|
181
157
|
|
182
|
-
*
|
158
|
+
*Rafael Mendonça França*
|
183
159
|
|
184
|
-
|
160
|
+
* Remove deprecated `ActiveRecord::ConnectionAdapters::AbstractAdapter#supports_multi_insert?`.
|
185
161
|
|
186
|
-
*
|
162
|
+
*Rafael Mendonça França*
|
187
163
|
|
188
|
-
|
164
|
+
* Remove deprecated `ActiveRecord::ConnectionAdapters::AbstractAdapter#supports_foreign_keys_in_create?`.
|
189
165
|
|
190
|
-
*
|
166
|
+
*Rafael Mendonça França*
|
191
167
|
|
192
|
-
|
168
|
+
* Remove deprecated `ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#supports_ranges?`.
|
193
169
|
|
194
|
-
*
|
170
|
+
*Rafael Mendonça França*
|
195
171
|
|
196
|
-
*
|
172
|
+
* Remove deprecated `ActiveRecord::Base#update_attributes` and `ActiveRecord::Base#update_attributes!`.
|
197
173
|
|
198
|
-
*
|
174
|
+
*Rafael Mendonça França*
|
199
175
|
|
200
|
-
*
|
201
|
-
calling `ActiveRecord::Dirty#changed_in_place?`
|
176
|
+
* Remove deprecated `migrations_path` argument in `ActiveRecord::ConnectionAdapter::SchemaStatements#assume_migrated_upto_version`.
|
202
177
|
|
203
|
-
|
178
|
+
*Rafael Mendonça França*
|
204
179
|
|
205
|
-
|
180
|
+
* Remove deprecated `config.active_record.sqlite3.represent_boolean_as_integer`.
|
206
181
|
|
207
|
-
*
|
182
|
+
*Rafael Mendonça França*
|
208
183
|
|
209
|
-
|
184
|
+
* `relation.create` does no longer leak scope to class level querying methods
|
185
|
+
in initialization block and callbacks.
|
210
186
|
|
211
|
-
|
187
|
+
Before:
|
212
188
|
|
189
|
+
User.where(name: "John").create do |john|
|
190
|
+
User.find_by(name: "David") # => nil
|
191
|
+
end
|
213
192
|
|
214
|
-
|
193
|
+
After:
|
215
194
|
|
216
|
-
|
195
|
+
User.where(name: "John").create do |john|
|
196
|
+
User.find_by(name: "David") # => #<User name: "David", ...>
|
197
|
+
end
|
217
198
|
|
199
|
+
*Ryuta Kamizono*
|
218
200
|
|
219
|
-
|
201
|
+
* Named scope chain does no longer leak scope to class level querying methods.
|
220
202
|
|
221
|
-
|
222
|
-
|
203
|
+
class User < ActiveRecord::Base
|
204
|
+
scope :david, -> { User.where(name: "David") }
|
205
|
+
end
|
223
206
|
|
224
|
-
|
207
|
+
Before:
|
225
208
|
|
226
|
-
|
209
|
+
User.where(name: "John").david
|
210
|
+
# SELECT * FROM users WHERE name = 'John' AND name = 'David'
|
227
211
|
|
228
|
-
|
229
|
-
column names.
|
212
|
+
After:
|
230
213
|
|
231
|
-
|
214
|
+
User.where(name: "John").david
|
215
|
+
# SELECT * FROM users WHERE name = 'David'
|
232
216
|
|
233
217
|
*Ryuta Kamizono*
|
234
218
|
|
219
|
+
* Remove deprecated methods from `ActiveRecord::DatabaseConfigurations`.
|
235
220
|
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
221
|
+
`fetch`
|
222
|
+
`each`
|
223
|
+
`first`
|
224
|
+
`values`
|
225
|
+
`[]=`
|
241
226
|
|
242
|
-
*
|
227
|
+
*Rafael Mendonça França*
|
243
228
|
|
244
|
-
*
|
229
|
+
* `where.not` now generates NAND predicates instead of NOR.
|
245
230
|
|
246
|
-
|
231
|
+
Before:
|
247
232
|
|
248
|
-
|
249
|
-
|
233
|
+
User.where.not(name: "Jon", role: "admin")
|
234
|
+
# SELECT * FROM users WHERE name != 'Jon' AND role != 'admin'
|
250
235
|
|
251
|
-
|
252
|
-
type of the primary key set in the association, not the model
|
253
|
-
primary key.
|
236
|
+
After:
|
254
237
|
|
255
|
-
|
238
|
+
User.where.not(name: "Jon", role: "admin")
|
239
|
+
# SELECT * FROM users WHERE NOT (name == 'Jon' AND role == 'admin')
|
256
240
|
|
257
|
-
*
|
258
|
-
of `Article.category(true)` where `category` is a singular
|
259
|
-
association.
|
241
|
+
*Rafael Mendonça França*
|
260
242
|
|
261
|
-
|
262
|
-
in #20888. Unfortunately the suggested alternative of
|
263
|
-
`article.reload.category` does not expose the same behavior.
|
243
|
+
* Remove deprecated `ActiveRecord::Result#to_hash` method.
|
264
244
|
|
265
|
-
|
266
|
-
singular associations. This method has the same semantics as
|
267
|
-
passing true to the association reader used to have.
|
245
|
+
*Rafael Mendonça França*
|
268
246
|
|
269
|
-
|
247
|
+
* Deprecate `ActiveRecord::Base.allow_unsafe_raw_sql`.
|
270
248
|
|
271
|
-
*
|
272
|
-
constants defined in `ActiveRecord::Associations::Preloader`.
|
249
|
+
*Rafael Mendonça França*
|
273
250
|
|
274
|
-
|
251
|
+
* Remove deprecated support for using unsafe raw SQL in `ActiveRecord::Relation` methods.
|
275
252
|
|
276
|
-
*
|
277
|
-
values for Postgres HStore columns.
|
253
|
+
*Rafael Mendonça França*
|
278
254
|
|
279
|
-
|
255
|
+
* Allow users to silence the "Rails couldn't infer whether you are using multiple databases..."
|
256
|
+
message using `config.active_record.suppress_multiple_database_warning`.
|
280
257
|
|
281
|
-
*
|
258
|
+
*Omri Gabay*
|
282
259
|
|
283
|
-
*
|
260
|
+
* Connections can be granularly switched for abstract classes when `connected_to` is called.
|
284
261
|
|
285
|
-
|
286
|
-
until it's actually needed.
|
262
|
+
This change allows `connected_to` to switch a `role` and/or `shard` for a single abstract class instead of all classes globally. Applications that want to use the new feature need to set `config.active_record.legacy_connection_handling` to `false` in their application configuration.
|
287
263
|
|
288
|
-
|
289
|
-
cache may notice that the connection's cache is now cleared and disabled
|
290
|
-
when it gets returned to the pool, even if the request is not yet completed.
|
264
|
+
Example usage:
|
291
265
|
|
292
|
-
|
266
|
+
Given an application we have a `User` model that inherits from `ApplicationRecord` and a `Dog` model that inherits from `AnimalsRecord`. `AnimalsRecord` and `ApplicationRecord` have writing and reading connections as well as shard `default`, `one`, and `two`.
|
293
267
|
|
294
|
-
|
295
|
-
|
268
|
+
```ruby
|
269
|
+
ActiveRecord::Base.connected_to(role: :reading) do
|
270
|
+
User.first # reads from default replica
|
271
|
+
Dog.first # reads from default replica
|
296
272
|
|
297
|
-
|
273
|
+
AnimalsRecord.connected_to(role: :writing, shard: :one) do
|
274
|
+
User.first # reads from default replica
|
275
|
+
Dog.first # reads from shard one primary
|
276
|
+
end
|
298
277
|
|
299
|
-
|
300
|
-
|
278
|
+
User.first # reads from default replica
|
279
|
+
Dog.first # reads from default replica
|
301
280
|
|
302
|
-
|
281
|
+
ApplicationRecord.connected_to(role: :writing, shard: :two) do
|
282
|
+
User.first # reads from shard two primary
|
283
|
+
Dog.first # reads from default replica
|
284
|
+
end
|
285
|
+
end
|
286
|
+
```
|
303
287
|
|
304
|
-
*
|
288
|
+
*Eileen M. Uchitelle*, *John Crepezzi*
|
305
289
|
|
306
|
-
*
|
290
|
+
* Allow double-dash comment syntax when querying read-only databases
|
307
291
|
|
308
|
-
*
|
292
|
+
*James Adam*
|
309
293
|
|
310
|
-
*
|
294
|
+
* Add `values_at` method.
|
311
295
|
|
312
|
-
|
313
|
-
string keys. This was creating inconsistency with other details that are
|
314
|
-
added using the `Errors#add` method. It was also inconsistent with the
|
315
|
-
`Errors#messages` storage.
|
296
|
+
Returns an array containing the values associated with the given methods.
|
316
297
|
|
317
|
-
|
318
|
-
|
319
|
-
|
298
|
+
```ruby
|
299
|
+
topic = Topic.first
|
300
|
+
topic.values_at(:title, :author_name)
|
301
|
+
# => ["Budget", "Jason"]
|
302
|
+
```
|
320
303
|
|
321
|
-
|
304
|
+
Similar to `Hash#values_at` but on an Active Record instance.
|
322
305
|
|
323
|
-
*
|
306
|
+
*Guillaume Briday*
|
324
307
|
|
325
|
-
*
|
326
|
-
saying the connection is closed rather than an undefined method error message.
|
308
|
+
* Fix `read_attribute_before_type_cast` to consider attribute aliases.
|
327
309
|
|
328
|
-
*
|
310
|
+
*Marcelo Lauxen*
|
329
311
|
|
330
|
-
*
|
331
|
-
loaded then the foreign key is changed directly and the record saved.
|
312
|
+
* Support passing record to uniqueness validator `:conditions` callable:
|
332
313
|
|
333
|
-
|
314
|
+
```ruby
|
315
|
+
class Article < ApplicationRecord
|
316
|
+
validates_uniqueness_of :title, conditions: ->(article) {
|
317
|
+
published_at = article.published_at
|
318
|
+
where(published_at: published_at.beginning_of_year..published_at.end_of_year)
|
319
|
+
}
|
320
|
+
end
|
321
|
+
```
|
334
322
|
|
335
|
-
*
|
336
|
-
in the array.
|
323
|
+
*Eliot Sykes*
|
337
324
|
|
338
|
-
|
325
|
+
* `BatchEnumerator#update_all` and `BatchEnumerator#delete_all` now return the
|
326
|
+
total number of rows affected, just like their non-batched counterparts.
|
339
327
|
|
340
|
-
|
328
|
+
```ruby
|
329
|
+
Person.in_batches.update_all("first_name = 'Eugene'") # => 42
|
330
|
+
Person.in_batches.delete_all # => 42
|
331
|
+
```
|
341
332
|
|
342
|
-
|
343
|
-
`after_initialize` callbacks are run.
|
333
|
+
Fixes #40287.
|
344
334
|
|
345
|
-
|
335
|
+
*Eugene Kenny*
|
346
336
|
|
347
|
-
|
337
|
+
* Add support for PostgreSQL `interval` data type with conversion to
|
338
|
+
`ActiveSupport::Duration` when loading records from database and
|
339
|
+
serialization to ISO 8601 formatted duration string on save.
|
340
|
+
Add support to define a column in migrations and get it in a schema dump.
|
341
|
+
Optional column precision is supported.
|
348
342
|
|
349
|
-
|
350
|
-
the `pluck` method on a collection.
|
343
|
+
To use this in 6.1, you need to place the next string to your model file:
|
351
344
|
|
352
|
-
|
345
|
+
attribute :duration, :interval
|
353
346
|
|
354
|
-
|
347
|
+
To keep old behavior until 6.2 is released:
|
355
348
|
|
356
|
-
|
357
|
-
successfully rolled back when the column was given and invalid column
|
358
|
-
type.
|
349
|
+
attribute :duration, :string
|
359
350
|
|
360
|
-
|
351
|
+
Example:
|
361
352
|
|
362
|
-
|
353
|
+
create_table :events do |t|
|
354
|
+
t.string :name
|
355
|
+
t.interval :duration
|
356
|
+
end
|
363
357
|
|
364
|
-
|
365
|
-
|
358
|
+
class Event < ApplicationRecord
|
359
|
+
attribute :duration, :interval
|
360
|
+
end
|
366
361
|
|
367
|
-
|
362
|
+
Event.create!(name: 'Rock Fest', duration: 2.days)
|
363
|
+
Event.last.duration # => 2 days
|
364
|
+
Event.last.duration.iso8601 # => "P2D"
|
365
|
+
Event.new(duration: 'P1DT12H3S').duration # => 1 day, 12 hours, and 3 seconds
|
366
|
+
Event.new(duration: '1 day') # Unknown value will be ignored and NULL will be written to database
|
368
367
|
|
369
|
-
*
|
368
|
+
*Andrey Novikov*
|
370
369
|
|
371
|
-
*
|
372
|
-
force a DISTINCT. This solves issues when using count after a left_joins.
|
370
|
+
* Allow associations supporting the `dependent:` key to take `dependent: :destroy_async`.
|
373
371
|
|
374
|
-
|
372
|
+
```ruby
|
373
|
+
class Account < ActiveRecord::Base
|
374
|
+
belongs_to :supplier, dependent: :destroy_async
|
375
|
+
end
|
376
|
+
```
|
375
377
|
|
376
|
-
|
377
|
-
`model` methods to be consistent with RecordNotFound raised by Record.find.
|
378
|
+
`:destroy_async` will enqueue a job to destroy associated records in the background.
|
378
379
|
|
379
|
-
*
|
380
|
+
*DHH*, *George Claghorn*, *Cory Gwin*, *Rafael Mendonça França*, *Adrianna Chang*
|
380
381
|
|
381
|
-
*
|
382
|
+
* Add `SKIP_TEST_DATABASE` environment variable to disable modifying the test database when `rails db:create` and `rails db:drop` are called.
|
382
383
|
|
383
|
-
*
|
384
|
+
*Jason Schweier*
|
384
385
|
|
385
|
-
*
|
386
|
-
database
|
386
|
+
* `connects_to` can only be called on `ActiveRecord::Base` or abstract classes.
|
387
387
|
|
388
|
-
|
388
|
+
Ensure that `connects_to` can only be called from `ActiveRecord::Base` or abstract classes. This protects the application from opening duplicate or too many connections.
|
389
389
|
|
390
|
-
*
|
390
|
+
*Eileen M. Uchitelle*, *John Crepezzi*
|
391
391
|
|
392
|
-
|
392
|
+
* All connection adapters `execute` now raises `ActiveRecord::ConnectionNotEstablished` rather than
|
393
|
+
`ActiveRecord::StatementInvalid` when they encounter a connection error.
|
393
394
|
|
394
|
-
*
|
395
|
+
*Jean Boussier*
|
395
396
|
|
396
|
-
|
397
|
-
|
397
|
+
* `Mysql2Adapter#quote_string` now raises `ActiveRecord::ConnectionNotEstablished` rather than
|
398
|
+
`ActiveRecord::StatementInvalid` when it can't connect to the MySQL server.
|
398
399
|
|
399
|
-
*
|
400
|
+
*Jean Boussier*
|
400
401
|
|
401
|
-
*
|
402
|
-
the hash keys after calling a calculation method like `count`.
|
402
|
+
* Add support for check constraints that are `NOT VALID` via `validate: false` (PostgreSQL-only).
|
403
403
|
|
404
|
-
|
404
|
+
*Alex Robbin*
|
405
405
|
|
406
|
-
|
406
|
+
* Ensure the default configuration is considered primary or first for an environment
|
407
407
|
|
408
|
-
|
409
|
-
same connection to two threads.
|
408
|
+
If a multiple database application provides a configuration named primary, that will be treated as default. In applications that do not have a primary entry, the default database configuration will be the first configuration for an environment.
|
410
409
|
|
411
|
-
|
410
|
+
*Eileen M. Uchitelle*
|
412
411
|
|
413
|
-
|
412
|
+
* Allow `where` references association names as joined table name aliases.
|
414
413
|
|
415
|
-
|
416
|
-
|
414
|
+
```ruby
|
415
|
+
class Comment < ActiveRecord::Base
|
416
|
+
enum label: [:default, :child]
|
417
|
+
has_many :children, class_name: "Comment", foreign_key: :parent_id
|
418
|
+
end
|
417
419
|
|
418
|
-
|
420
|
+
# ... FROM comments LEFT OUTER JOIN comments children ON ... WHERE children.label = 1
|
421
|
+
Comment.includes(:children).where("children.label": "child")
|
422
|
+
```
|
419
423
|
|
420
424
|
*Ryuta Kamizono*
|
421
425
|
|
426
|
+
* Support storing demodulized class name for polymorphic type.
|
422
427
|
|
423
|
-
|
424
|
-
|
425
|
-
* Inspecting an object with an associated array of over 10 elements no longer
|
426
|
-
truncates the array, preventing `inspect` from looping infinitely in some
|
427
|
-
cases.
|
428
|
-
|
429
|
-
*Kevin McPhillips*
|
430
|
-
|
431
|
-
* Ensure hashes can be assigned to attributes created using `composed_of`.
|
428
|
+
Before Rails 6.1, storing demodulized class name is supported only for STI type
|
429
|
+
by `store_full_sti_class` class attribute.
|
432
430
|
|
433
|
-
|
431
|
+
Now `store_full_class_name` class attribute can handle both STI and polymorphic types.
|
434
432
|
|
435
|
-
*
|
436
|
-
|
437
|
-
* Fix logging edge case where if an attribute was of the binary type and
|
438
|
-
was provided as a Hash.
|
439
|
-
|
440
|
-
*Jon Moss*
|
433
|
+
*Ryuta Kamizono*
|
441
434
|
|
442
|
-
*
|
443
|
-
|
435
|
+
* Deprecate `rails db:structure:{load, dump}` tasks and extend
|
436
|
+
`rails db:schema:{load, dump}` tasks to work with either `:ruby` or `:sql` format,
|
437
|
+
depending on `config.active_record.schema_format` configuration value.
|
444
438
|
|
445
|
-
*
|
439
|
+
*fatkodima*
|
446
440
|
|
447
|
-
*
|
441
|
+
* Respect the `select` values for eager loading.
|
448
442
|
|
449
|
-
|
443
|
+
```ruby
|
444
|
+
post = Post.select("UPPER(title) AS title").first
|
445
|
+
post.title # => "WELCOME TO THE WEBLOG"
|
446
|
+
post.body # => ActiveModel::MissingAttributeError
|
450
447
|
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
448
|
+
# Rails 6.0 (ignore the `select` values)
|
449
|
+
post = Post.select("UPPER(title) AS title").eager_load(:comments).first
|
450
|
+
post.title # => "Welcome to the weblog"
|
451
|
+
post.body # => "Such a lovely day"
|
455
452
|
|
456
|
-
|
453
|
+
# Rails 6.1 (respect the `select` values)
|
454
|
+
post = Post.select("UPPER(title) AS title").eager_load(:comments).first
|
455
|
+
post.title # => "WELCOME TO THE WEBLOG"
|
456
|
+
post.body # => ActiveModel::MissingAttributeError
|
457
|
+
```
|
457
458
|
|
458
459
|
*Ryuta Kamizono*
|
459
460
|
|
460
|
-
*
|
461
|
-
|
462
|
-
To enable, set `prepared_statements: true` in config/database.yml.
|
463
|
-
Requires mysql2 0.4.4+.
|
464
|
-
|
465
|
-
*Ryuta Kamizono*
|
461
|
+
* Allow attribute's default to be configured but keeping its own type.
|
466
462
|
|
467
|
-
|
468
|
-
|
463
|
+
```ruby
|
464
|
+
class Post < ActiveRecord::Base
|
465
|
+
attribute :written_at, default: -> { Time.now.utc }
|
466
|
+
end
|
469
467
|
|
470
|
-
|
468
|
+
# Rails 6.0
|
469
|
+
Post.type_for_attribute(:written_at) # => #<Type::Value ... precision: nil, ...>
|
471
470
|
|
472
|
-
|
473
|
-
|
471
|
+
# Rails 6.1
|
472
|
+
Post.type_for_attribute(:written_at) # => #<Type::DateTime ... precision: 6, ...>
|
473
|
+
```
|
474
474
|
|
475
475
|
*Ryuta Kamizono*
|
476
476
|
|
477
|
-
*
|
478
|
-
|
479
|
-
SQLite doesn't impose length restrictions on strings, BLOBs, or numeric
|
480
|
-
values. It treats them as helpful metadata. When we truncate strings
|
481
|
-
before checking uniqueness, we'd miss values that exceed the column limit.
|
482
|
-
|
483
|
-
Other databases enforce length limits. A large value will pass uniqueness
|
484
|
-
validation since the column limit guarantees no value that long exists.
|
485
|
-
When we insert the row, it'll raise `ActiveRecord::ValueTooLong` as we
|
486
|
-
expect.
|
477
|
+
* Allow default to be configured for Enum.
|
487
478
|
|
488
|
-
|
489
|
-
|
490
|
-
|
479
|
+
```ruby
|
480
|
+
class Book < ActiveRecord::Base
|
481
|
+
enum status: [:proposed, :written, :published], _default: :published
|
482
|
+
end
|
491
483
|
|
492
|
-
|
493
|
-
|
494
|
-
* Raise `ActiveRecord::ValueTooLong` when column limits are exceeded.
|
495
|
-
Supported by MySQL and PostgreSQL adapters.
|
484
|
+
Book.new.status # => "published"
|
485
|
+
```
|
496
486
|
|
497
487
|
*Ryuta Kamizono*
|
498
488
|
|
499
|
-
*
|
489
|
+
* Deprecate YAML loading from legacy format older than Rails 5.0.
|
500
490
|
|
501
491
|
*Ryuta Kamizono*
|
502
492
|
|
503
|
-
*
|
493
|
+
* Added the setting `ActiveRecord::Base.immutable_strings_by_default`, which
|
494
|
+
allows you to specify that all string columns should be frozen unless
|
495
|
+
otherwise specified. This will reduce memory pressure for applications which
|
496
|
+
do not generally mutate string properties of Active Record objects.
|
504
497
|
|
505
|
-
|
506
|
-
According to the SQL standard, PRIMARY KEY should always imply NOT
|
507
|
-
NULL. Unfortunately, due to a bug in some early versions, this is not
|
508
|
-
the case in SQLite. Unless the column is an INTEGER PRIMARY KEY or the
|
509
|
-
table is a WITHOUT ROWID table or the column is declared NOT NULL,
|
510
|
-
SQLite allows NULL values in a PRIMARY KEY column. SQLite could be
|
511
|
-
fixed to conform to the standard, but doing so might break legacy
|
512
|
-
applications. Hence, it has been decided to merely document the fact
|
513
|
-
that SQLite allowing NULLs in most PRIMARY KEY columns.
|
498
|
+
*Sean Griffin*, *Ryuta Kamizono*
|
514
499
|
|
515
|
-
|
516
|
-
on implicit NOT NULL like MySQL and PostgreSQL adapters.
|
500
|
+
* Deprecate `map!` and `collect!` on `ActiveRecord::Result`.
|
517
501
|
|
518
502
|
*Ryuta Kamizono*
|
519
503
|
|
520
|
-
*
|
504
|
+
* Support `relation.and` for intersection as Set theory.
|
521
505
|
|
522
|
-
|
506
|
+
```ruby
|
507
|
+
david_and_mary = Author.where(id: [david, mary])
|
508
|
+
mary_and_bob = Author.where(id: [mary, bob])
|
523
509
|
|
524
|
-
|
525
|
-
Created database 'blog_development'
|
526
|
-
Created database 'blog_test'
|
510
|
+
david_and_mary.merge(mary_and_bob) # => [mary, bob]
|
527
511
|
|
528
|
-
|
529
|
-
|
530
|
-
|
512
|
+
david_and_mary.and(mary_and_bob) # => [mary]
|
513
|
+
david_and_mary.or(mary_and_bob) # => [david, mary, bob]
|
514
|
+
```
|
531
515
|
|
532
|
-
|
533
|
-
`blog_development already exists` to `Database 'blog_development' already exists`.
|
534
|
-
and
|
535
|
-
`Couldn't drop blog_development` to `Couldn't drop database 'blog_development'`.
|
516
|
+
*Ryuta Kamizono*
|
536
517
|
|
537
|
-
|
518
|
+
* Merging conditions on the same column no longer maintain both conditions,
|
519
|
+
and will be consistently replaced by the latter condition in Rails 6.2.
|
520
|
+
To migrate to Rails 6.2's behavior, use `relation.merge(other, rewhere: true)`.
|
538
521
|
|
539
|
-
|
540
|
-
|
522
|
+
```ruby
|
523
|
+
# Rails 6.1 (IN clause is replaced by merger side equality condition)
|
524
|
+
Author.where(id: [david.id, mary.id]).merge(Author.where(id: bob)) # => [bob]
|
541
525
|
|
542
|
-
|
543
|
-
|
544
|
-
t.string :locale, comment: 'RFC 3066 locale code of website language section'
|
545
|
-
t.index [:path, :locale], comment: 'Look up pages by URI'
|
546
|
-
end
|
526
|
+
# Rails 6.1 (both conflict conditions exists, deprecated)
|
527
|
+
Author.where(id: david.id..mary.id).merge(Author.where(id: bob)) # => []
|
547
528
|
|
548
|
-
|
529
|
+
# Rails 6.1 with rewhere to migrate to Rails 6.2's behavior
|
530
|
+
Author.where(id: david.id..mary.id).merge(Author.where(id: bob), rewhere: true) # => [bob]
|
549
531
|
|
550
|
-
|
551
|
-
|
552
|
-
|
532
|
+
# Rails 6.2 (same behavior with IN clause, mergee side condition is consistently replaced)
|
533
|
+
Author.where(id: [david.id, mary.id]).merge(Author.where(id: bob)) # => [bob]
|
534
|
+
Author.where(id: david.id..mary.id).merge(Author.where(id: bob)) # => [bob]
|
535
|
+
```
|
553
536
|
|
554
537
|
*Ryuta Kamizono*
|
555
538
|
|
556
|
-
*
|
557
|
-
|
558
|
-
Fixes #24234
|
559
|
-
|
560
|
-
*Sean Griffin*
|
539
|
+
* Do not mark Postgresql MAC address and UUID attributes as changed when the assigned value only varies by case.
|
561
540
|
|
562
|
-
*
|
541
|
+
*Peter Fry*
|
563
542
|
|
564
|
-
|
543
|
+
* Resolve issue with insert_all unique_by option when used with expression index.
|
565
544
|
|
566
|
-
|
545
|
+
When the `:unique_by` option of `ActiveRecord::Persistence.insert_all` and
|
546
|
+
`ActiveRecord::Persistence.upsert_all` was used with the name of an expression index, an error
|
547
|
+
was raised. Adding a guard around the formatting behavior for the `:unique_by` corrects this.
|
567
548
|
|
568
|
-
|
569
|
-
|
570
|
-
# When no record is found on the table
|
571
|
-
Topic.none? # => true
|
572
|
-
|
573
|
-
# When only one record is found on the table
|
574
|
-
Topic.one? # => true
|
575
|
-
|
576
|
-
*Kenta Shirai*
|
549
|
+
Usage:
|
577
550
|
|
578
|
-
|
579
|
-
|
551
|
+
```ruby
|
552
|
+
create_table :books, id: :integer, force: true do |t|
|
553
|
+
t.column :name, :string
|
554
|
+
t.index "lower(name)", unique: true
|
555
|
+
end
|
580
556
|
|
581
|
-
|
557
|
+
Book.insert_all [{ name: "MyTest" }], unique_by: :index_books_on_lower_name
|
558
|
+
```
|
582
559
|
|
583
|
-
|
560
|
+
Fixes #39516.
|
584
561
|
|
585
|
-
*
|
562
|
+
*Austen Madden*
|
586
563
|
|
587
|
-
|
564
|
+
* Add basic support for CHECK constraints to database migrations.
|
588
565
|
|
589
|
-
|
566
|
+
Usage:
|
590
567
|
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
568
|
+
```ruby
|
569
|
+
add_check_constraint :products, "price > 0", name: "price_check"
|
570
|
+
remove_check_constraint :products, name: "price_check"
|
571
|
+
```
|
595
572
|
|
596
|
-
*
|
573
|
+
*fatkodima*
|
597
574
|
|
598
|
-
*
|
575
|
+
* Add `ActiveRecord::Base.strict_loading_by_default` and `ActiveRecord::Base.strict_loading_by_default=`
|
576
|
+
to enable/disable strict_loading mode by default for a model. The configuration's value is
|
577
|
+
inheritable by subclasses, but they can override that value and it will not impact parent class.
|
599
578
|
|
600
|
-
|
601
|
-
Fixes #10658.
|
579
|
+
Usage:
|
602
580
|
|
603
|
-
|
581
|
+
```ruby
|
582
|
+
class Developer < ApplicationRecord
|
583
|
+
self.strict_loading_by_default = true
|
604
584
|
|
605
|
-
|
606
|
-
|
607
|
-
instance dependent scope. This is no longer the case.
|
585
|
+
has_many :projects
|
586
|
+
end
|
608
587
|
|
609
|
-
|
588
|
+
dev = Developer.first
|
589
|
+
dev.projects.first
|
590
|
+
# => ActiveRecord::StrictLoadingViolationError Exception: Developer is marked as strict_loading and Project cannot be lazily loaded.
|
591
|
+
```
|
610
592
|
|
611
|
-
*
|
593
|
+
*bogdanvlviv*
|
612
594
|
|
613
|
-
* Deprecate `
|
614
|
-
Use the `{insert|update|delete}` public methods instead.
|
595
|
+
* Deprecate passing an Active Record object to `quote`/`type_cast` directly.
|
615
596
|
|
616
597
|
*Ryuta Kamizono*
|
617
598
|
|
618
|
-
*
|
619
|
-
if the order or limit is ignored in a batch query, rather than logging a
|
620
|
-
warning message.
|
621
|
-
|
622
|
-
*Scott Ringwelski*
|
599
|
+
* Default engine `ENGINE=InnoDB` is no longer dumped to make schema more agnostic.
|
623
600
|
|
624
|
-
|
601
|
+
Before:
|
625
602
|
|
626
|
-
|
603
|
+
```ruby
|
604
|
+
create_table "accounts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
|
605
|
+
end
|
606
|
+
```
|
627
607
|
|
628
|
-
|
608
|
+
After:
|
629
609
|
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
610
|
+
```ruby
|
611
|
+
create_table "accounts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
612
|
+
end
|
613
|
+
```
|
634
614
|
|
635
|
-
|
615
|
+
*Ryuta Kamizono*
|
636
616
|
|
637
|
-
|
617
|
+
* Added delegated type as an alternative to single-table inheritance for representing class hierarchies.
|
618
|
+
See ActiveRecord::DelegatedType for the full description.
|
638
619
|
|
639
|
-
*
|
620
|
+
*DHH*
|
640
621
|
|
641
|
-
|
642
|
-
validations. There's no reason to validate a record you aren't planning on saving.
|
622
|
+
* Deprecate aggregations with group by duplicated fields.
|
643
623
|
|
644
|
-
|
624
|
+
To migrate to Rails 6.2's behavior, use `uniq!(:group)` to deduplicate group fields.
|
645
625
|
|
646
|
-
|
626
|
+
```ruby
|
627
|
+
accounts = Account.group(:firm_id)
|
647
628
|
|
648
|
-
|
629
|
+
# duplicated group fields, deprecated.
|
630
|
+
accounts.merge(accounts.where.not(credit_limit: nil)).sum(:credit_limit)
|
631
|
+
# => {
|
632
|
+
# [1, 1] => 50,
|
633
|
+
# [2, 2] => 60
|
634
|
+
# }
|
649
635
|
|
650
|
-
|
636
|
+
# use `uniq!(:group)` to deduplicate group fields.
|
637
|
+
accounts.merge(accounts.where.not(credit_limit: nil)).uniq!(:group).sum(:credit_limit)
|
638
|
+
# => {
|
639
|
+
# 1 => 50,
|
640
|
+
# 2 => 60
|
641
|
+
# }
|
642
|
+
```
|
651
643
|
|
652
|
-
*
|
653
|
-
do not affect the original relation, by returning a duplicate array each time.
|
644
|
+
*Ryuta Kamizono*
|
654
645
|
|
655
|
-
|
656
|
-
already more careful.
|
646
|
+
* Deprecate duplicated query annotations.
|
657
647
|
|
658
|
-
|
648
|
+
To migrate to Rails 6.2's behavior, use `uniq!(:annotate)` to deduplicate query annotations.
|
659
649
|
|
660
|
-
|
650
|
+
```ruby
|
651
|
+
accounts = Account.where(id: [1, 2]).annotate("david and mary")
|
661
652
|
|
662
|
-
|
653
|
+
# duplicated annotations, deprecated.
|
654
|
+
accounts.merge(accounts.rewhere(id: 3))
|
655
|
+
# SELECT accounts.* FROM accounts WHERE accounts.id = 3 /* david and mary */ /* david and mary */
|
663
656
|
|
664
|
-
|
657
|
+
# use `uniq!(:annotate)` to deduplicate annotations.
|
658
|
+
accounts.merge(accounts.rewhere(id: 3)).uniq!(:annotate)
|
659
|
+
# SELECT accounts.* FROM accounts WHERE accounts.id = 3 /* david and mary */
|
660
|
+
```
|
665
661
|
|
666
|
-
|
667
|
-
# => SELECT "price_estimates".* FROM "price_estimates"
|
668
|
-
WHERE (("price_estimates"."estimate_of_type" = 'Treasure' AND "price_estimates"."estimate_of_id" = 1)
|
669
|
-
OR ("price_estimates"."estimate_of_type" = 'Car' AND "price_estimates"."estimate_of_id" = 2))
|
662
|
+
*Ryuta Kamizono*
|
670
663
|
|
671
|
-
|
664
|
+
* Resolve conflict between counter cache and optimistic locking.
|
672
665
|
|
673
|
-
|
674
|
-
|
666
|
+
Bump an Active Record instance's lock version after updating its counter
|
667
|
+
cache. This avoids raising an unnecessary `ActiveRecord::StaleObjectError`
|
668
|
+
upon subsequent transactions by maintaining parity with the corresponding
|
669
|
+
database record's `lock_version` column.
|
675
670
|
|
676
|
-
|
671
|
+
Fixes #16449.
|
677
672
|
|
678
|
-
*
|
679
|
-
results in same child records getting added repeatedly to target.
|
673
|
+
*Aaron Lipman*
|
680
674
|
|
681
|
-
|
675
|
+
* Support merging option `:rewhere` to allow mergee side condition to be replaced exactly.
|
682
676
|
|
683
|
-
|
677
|
+
```ruby
|
678
|
+
david_and_mary = Author.where(id: david.id..mary.id)
|
684
679
|
|
685
|
-
|
680
|
+
# both conflict conditions exists
|
681
|
+
david_and_mary.merge(Author.where(id: bob)) # => []
|
686
682
|
|
687
|
-
|
688
|
-
|
689
|
-
3. Deprecated relation loading when SQL order can not be automatically reversed
|
683
|
+
# mergee side condition is replaced by rewhere
|
684
|
+
david_and_mary.merge(Author.rewhere(id: bob)) # => [bob]
|
690
685
|
|
691
|
-
|
692
|
-
|
693
|
-
|
686
|
+
# mergee side condition is replaced by rewhere option
|
687
|
+
david_and_mary.merge(Author.where(id: bob), rewhere: true) # => [bob]
|
688
|
+
```
|
694
689
|
|
695
|
-
|
696
|
-
# before: SELECT * FROM `topics`
|
697
|
-
# after: SELECT * FROM `topics` ORDER BY `topics`.`title` DESC LIMIT 1
|
690
|
+
*Ryuta Kamizono*
|
698
691
|
|
699
|
-
|
700
|
-
|
701
|
-
|
692
|
+
* Add support for finding records based on signed ids, which are tamper-proof, verified ids that can be
|
693
|
+
set to expire and scoped with a purpose. This is particularly useful for things like password reset
|
694
|
+
or email verification, where you want the bearer of the signed id to be able to interact with the
|
695
|
+
underlying record, but usually only within a certain time period.
|
702
696
|
|
703
|
-
|
697
|
+
```ruby
|
698
|
+
signed_id = User.first.signed_id expires_in: 15.minutes, purpose: :password_reset
|
704
699
|
|
705
|
-
|
700
|
+
User.find_signed signed_id # => nil, since the purpose does not match
|
706
701
|
|
707
|
-
|
702
|
+
travel 16.minutes
|
703
|
+
User.find_signed signed_id, purpose: :password_reset # => nil, since the signed id has expired
|
708
704
|
|
709
|
-
|
705
|
+
travel_back
|
706
|
+
User.find_signed signed_id, purpose: :password_reset # => User.first
|
710
707
|
|
711
|
-
|
708
|
+
User.find_signed! "bad data" # => ActiveSupport::MessageVerifier::InvalidSignature
|
709
|
+
```
|
712
710
|
|
713
|
-
*
|
711
|
+
*DHH*
|
714
712
|
|
715
|
-
*
|
713
|
+
* Support `ALGORITHM = INSTANT` DDL option for index operations on MySQL.
|
716
714
|
|
717
|
-
|
715
|
+
*Ryuta Kamizono*
|
718
716
|
|
719
|
-
|
720
|
-
t.numeric :numeric_type, precision: 10, scale: 2
|
721
|
-
end
|
717
|
+
* Fix index creation to preserve index comment in bulk change table on MySQL.
|
722
718
|
|
723
|
-
*
|
719
|
+
*Ryuta Kamizono*
|
724
720
|
|
725
|
-
*
|
726
|
-
Both PG 9.0 and 8.4 are past their end of life date:
|
727
|
-
http://www.postgresql.org/support/versioning/
|
721
|
+
* Allow `unscope` to be aware of table name qualified values.
|
728
722
|
|
729
|
-
|
723
|
+
It is possible to unscope only the column in the specified table.
|
730
724
|
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
relation without any order and table has no primary key:
|
725
|
+
```ruby
|
726
|
+
posts = Post.joins(:comments).group(:"posts.hidden")
|
727
|
+
posts = posts.where("posts.hidden": false, "comments.hidden": false)
|
735
728
|
|
736
|
-
|
737
|
-
|
738
|
-
# After: raises ActiveRecord::IrreversibleOrderError
|
739
|
-
Edge.all.reverse_order
|
740
|
-
# Before: SELECT `edges`.* FROM `edges` ORDER BY `edges`.`` DESC
|
741
|
-
# After: raises ActiveRecord::IrreversibleOrderError
|
729
|
+
posts.count
|
730
|
+
# => { false => 10 }
|
742
731
|
|
743
|
-
|
732
|
+
# unscope both hidden columns
|
733
|
+
posts.unscope(where: :hidden).count
|
734
|
+
# => { false => 11, true => 1 }
|
744
735
|
|
745
|
-
|
746
|
-
|
736
|
+
# unscope only comments.hidden column
|
737
|
+
posts.unscope(where: :"comments.hidden").count
|
738
|
+
# => { false => 11 }
|
739
|
+
```
|
747
740
|
|
748
|
-
*
|
741
|
+
*Ryuta Kamizono*, *Slava Korolev*
|
749
742
|
|
750
|
-
*
|
751
|
-
for the referenced column by default, without adding `index: true` option
|
752
|
-
to generated migration file. Users can opt out of this by passing
|
753
|
-
`index: false`.
|
743
|
+
* Fix `rewhere` to truly overwrite collided where clause by new where clause.
|
754
744
|
|
755
|
-
|
745
|
+
```ruby
|
746
|
+
steve = Person.find_by(name: "Steve")
|
747
|
+
david = Author.find_by(name: "David")
|
756
748
|
|
757
|
-
|
749
|
+
relation = Essay.where(writer: steve)
|
758
750
|
|
759
|
-
|
760
|
-
|
761
|
-
custom STI mappings.
|
751
|
+
# Before
|
752
|
+
relation.rewhere(writer: david).to_a # => []
|
762
753
|
|
763
|
-
|
754
|
+
# After
|
755
|
+
relation.rewhere(writer: david).to_a # => [david]
|
756
|
+
```
|
764
757
|
|
765
|
-
*
|
758
|
+
*Ryuta Kamizono*
|
766
759
|
|
767
|
-
*
|
768
|
-
they are passed as procs.
|
760
|
+
* Inspect time attributes with subsec and time zone offset.
|
769
761
|
|
770
|
-
|
771
|
-
|
762
|
+
```ruby
|
763
|
+
p Knot.create
|
764
|
+
=> #<Knot id: 1, created_at: "2016-05-05 01:29:47.116928000 +0000">
|
765
|
+
```
|
772
766
|
|
773
|
-
|
767
|
+
*akinomaeni*, *Jonathan Hefner*
|
774
768
|
|
775
|
-
|
776
|
-
t.datetime :published_at, default: -> { 'NOW()' }
|
777
|
-
end
|
769
|
+
* Deprecate passing a column to `type_cast`.
|
778
770
|
|
779
771
|
*Ryuta Kamizono*
|
780
772
|
|
781
|
-
*
|
773
|
+
* Deprecate `in_clause_length` and `allowed_index_name_length` in `DatabaseLimits`.
|
782
774
|
|
783
|
-
|
775
|
+
*Ryuta Kamizono*
|
784
776
|
|
785
|
-
|
777
|
+
* Support bulk insert/upsert on relation to preserve scope values.
|
786
778
|
|
787
|
-
*
|
788
|
-
`schema_migrations` versions are guaranteed to be unique.
|
779
|
+
*Josef Šimánek*, *Ryuta Kamizono*
|
789
780
|
|
790
|
-
|
791
|
-
not have a primary key.
|
781
|
+
* Preserve column comment value on changing column name on MySQL.
|
792
782
|
|
793
|
-
*
|
783
|
+
*Islam Taha*
|
794
784
|
|
795
|
-
* Add
|
785
|
+
* Add support for `if_exists` option for removing an index.
|
796
786
|
|
797
|
-
|
798
|
-
But in MySQL, these have limited length for each types (ref #21591, #21619).
|
799
|
-
This change adds short-hand methods for each text and blob types.
|
787
|
+
The `remove_index` method can take an `if_exists` option. If this is set to true an error won't be raised if the index doesn't exist.
|
800
788
|
|
801
|
-
|
789
|
+
*Eileen M. Uchitelle*
|
802
790
|
|
803
|
-
|
804
|
-
t.tinyblob :tiny_blob
|
805
|
-
t.mediumblob :medium_blob
|
806
|
-
t.longblob :long_blob
|
807
|
-
t.tinytext :tiny_text
|
808
|
-
t.mediumtext :medium_text
|
809
|
-
t.longtext :long_text
|
810
|
-
end
|
791
|
+
* Remove ibm_db, informix, mssql, oracle, and oracle12 Arel visitors which are not used in the code base.
|
811
792
|
|
812
793
|
*Ryuta Kamizono*
|
813
794
|
|
814
|
-
*
|
815
|
-
timestamp with offset specified to attribute of time type.
|
795
|
+
* Prevent `build_association` from `touching` a parent record if the record isn't persisted for `has_one` associations.
|
816
796
|
|
817
|
-
|
818
|
-
|
819
|
-
* When calling `first` with a `limit` argument, return directly from the
|
820
|
-
`loaded?` records if available.
|
797
|
+
Fixes #38219.
|
821
798
|
|
822
|
-
*
|
799
|
+
*Josh Brody*
|
823
800
|
|
824
|
-
*
|
825
|
-
`offset` method on relation instead.
|
801
|
+
* Add support for `if_not_exists` option for adding index.
|
826
802
|
|
827
|
-
|
803
|
+
The `add_index` method respects `if_not_exists` option. If it is set to true
|
804
|
+
index won't be added.
|
828
805
|
|
829
|
-
|
806
|
+
Usage:
|
830
807
|
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
Message belongs_to :project, touch: true
|
835
|
-
Project belongs_to :account, touch: true
|
808
|
+
```ruby
|
809
|
+
add_index :users, :account_id, if_not_exists: true
|
810
|
+
```
|
836
811
|
|
837
|
-
|
838
|
-
|
812
|
+
The `if_not_exists` option passed to `create_table` also gets propagated to indexes
|
813
|
+
created within that migration so that if table and its indexes exist then there is no
|
814
|
+
attempt to create them again.
|
839
815
|
|
840
|
-
|
816
|
+
*Prathamesh Sonpatki*
|
841
817
|
|
842
|
-
|
818
|
+
* Add `ActiveRecord::Base#previously_new_record?` to show if a record was new before the last save.
|
843
819
|
|
844
|
-
*
|
845
|
-
has no explicit order defined.
|
820
|
+
*Tom Ward*
|
846
821
|
|
847
|
-
|
822
|
+
* Support descending order for `find_each`, `find_in_batches`, and `in_batches`.
|
848
823
|
|
849
|
-
|
824
|
+
Batch processing methods allow you to work with the records in batches, greatly reducing memory consumption, but records are always batched from oldest id to newest.
|
850
825
|
|
851
|
-
|
852
|
-
change in the future, we can address that via Migration API Versioning.
|
826
|
+
This change allows reversing the order, batching from newest to oldest. This is useful when you need to process newer batches of records first.
|
853
827
|
|
854
|
-
|
828
|
+
Pass `order: :desc` to yield batches in descending order. The default remains `order: :asc`.
|
855
829
|
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
830
|
+
```ruby
|
831
|
+
Person.find_each(order: :desc) do |person|
|
832
|
+
person.party_all_night!
|
833
|
+
end
|
834
|
+
```
|
860
835
|
|
861
|
-
*
|
836
|
+
*Alexey Vasiliev*
|
862
837
|
|
863
|
-
*
|
864
|
-
name to check for.
|
838
|
+
* Fix `insert_all` with enum values.
|
865
839
|
|
866
|
-
|
840
|
+
Fixes #38716.
|
867
841
|
|
868
|
-
*
|
869
|
-
live on in a separate gem for now, but most users should just use `mysql2`.
|
842
|
+
*Joel Blum*
|
870
843
|
|
871
|
-
|
844
|
+
* Add support for `db:rollback:name` for multiple database applications.
|
872
845
|
|
873
|
-
|
874
|
-
controllers subclassing ApplicationController instead of
|
875
|
-
ActionController::Base. This gives apps a single spot to configure app-wide
|
876
|
-
model behavior.
|
846
|
+
Multiple database applications will now raise if `db:rollback` is call and recommend using the `db:rollback:[NAME]` to rollback migrations.
|
877
847
|
|
878
|
-
|
879
|
-
present by default.
|
848
|
+
*Eileen M. Uchitelle*
|
880
849
|
|
881
|
-
|
850
|
+
* `Relation#pick` now uses already loaded results instead of making another query.
|
882
851
|
|
883
|
-
*
|
884
|
-
defaults without breaking existing migrations, or forcing them to be
|
885
|
-
rewritten through a deprecation cycle.
|
852
|
+
*Eugene Kenny*
|
886
853
|
|
887
|
-
|
854
|
+
* Deprecate using `return`, `break` or `throw` to exit a transaction block after writes.
|
888
855
|
|
889
|
-
|
890
|
-
def change
|
891
|
-
# ...
|
892
|
-
end
|
893
|
-
end
|
856
|
+
*Dylan Thacker-Smith*
|
894
857
|
|
895
|
-
|
858
|
+
* Dump the schema or structure of a database when calling `db:migrate:name`.
|
896
859
|
|
897
|
-
|
898
|
-
fewer prepared statements for common tasks like pagination. To support this
|
899
|
-
change, passing a string containing a comma to `limit` has been deprecated,
|
900
|
-
and passing an Arel node to `limit` is no longer supported.
|
860
|
+
In previous versions of Rails, `rails db:migrate` would dump the schema of the database. In Rails 6, that holds true (`rails db:migrate` dumps all databases' schemas), but `rails db:migrate:name` does not share that behavior.
|
901
861
|
|
902
|
-
|
862
|
+
Going forward, calls to `rails db:migrate:name` will dump the schema (or structure) of the database being migrated.
|
903
863
|
|
904
|
-
*
|
864
|
+
*Kyle Thompson*
|
905
865
|
|
906
|
-
*
|
866
|
+
* Reset the `ActiveRecord::Base` connection after `rails db:migrate:name`.
|
907
867
|
|
908
|
-
|
868
|
+
When `rails db:migrate` has finished, it ensures the `ActiveRecord::Base` connection is reset to its original configuration. Going forward, `rails db:migrate:name` will have the same behavior.
|
909
869
|
|
910
|
-
|
911
|
-
after_commit :update_in_index_later, on: :update
|
912
|
-
after_commit :remove_from_index_later, on: :destroy
|
870
|
+
*Kyle Thompson*
|
913
871
|
|
914
|
-
|
872
|
+
* Disallow calling `connected_to` on subclasses of `ActiveRecord::Base`.
|
915
873
|
|
916
|
-
|
917
|
-
after_update_commit :update_in_index_later
|
918
|
-
after_destroy_commit :remove_from_index_later
|
874
|
+
Behavior has not changed here but the previous API could be misleading to people who thought it would switch connections for only that class. `connected_to` switches the context from which we are getting connections, not the connections themselves.
|
919
875
|
|
920
|
-
|
876
|
+
*Eileen M. Uchitelle*, *John Crepezzi*
|
921
877
|
|
922
|
-
|
878
|
+
* Add support for horizontal sharding to `connects_to` and `connected_to`.
|
923
879
|
|
924
|
-
|
925
|
-
instantiating records through the base class.
|
880
|
+
Applications can now connect to multiple shards and switch between their shards in an application. Note that the shard swapping is still a manual process as this change does not include an API for automatic shard swapping.
|
926
881
|
|
927
|
-
|
882
|
+
Usage:
|
928
883
|
|
929
|
-
|
884
|
+
Given the following configuration:
|
930
885
|
|
931
|
-
|
932
|
-
|
933
|
-
|
886
|
+
```yaml
|
887
|
+
# config/database.yml
|
888
|
+
production:
|
889
|
+
primary:
|
890
|
+
database: my_database
|
891
|
+
primary_shard_one:
|
892
|
+
database: my_database_shard_one
|
893
|
+
```
|
934
894
|
|
935
|
-
|
895
|
+
Connect to multiple shards:
|
936
896
|
|
937
|
-
|
897
|
+
```ruby
|
898
|
+
class ApplicationRecord < ActiveRecord::Base
|
899
|
+
self.abstract_class = true
|
938
900
|
|
939
|
-
|
901
|
+
connects_to shards: {
|
902
|
+
default: { writing: :primary },
|
903
|
+
shard_one: { writing: :primary_shard_one }
|
904
|
+
}
|
905
|
+
```
|
940
906
|
|
941
|
-
|
907
|
+
Swap between shards in your controller / model code:
|
942
908
|
|
943
|
-
|
909
|
+
```ruby
|
910
|
+
ActiveRecord::Base.connected_to(shard: :shard_one) do
|
911
|
+
# Read from shard one
|
912
|
+
end
|
913
|
+
```
|
944
914
|
|
945
|
-
|
915
|
+
The horizontal sharding API also supports read replicas. See guides for more details.
|
946
916
|
|
947
|
-
*
|
917
|
+
*Eileen M. Uchitelle*, *John Crepezzi*
|
948
918
|
|
949
|
-
|
919
|
+
* Deprecate `spec_name` in favor of `name` on database configurations.
|
950
920
|
|
951
|
-
|
921
|
+
The accessors for `spec_name` on `configs_for` and `DatabaseConfig` are deprecated. Please use `name` instead.
|
952
922
|
|
953
|
-
|
954
|
-
Also deprecate passing arguments to `#tables`.
|
955
|
-
And deprecate `table_exists?`.
|
923
|
+
Deprecated behavior:
|
956
924
|
|
957
|
-
|
958
|
-
|
959
|
-
|
925
|
+
```ruby
|
926
|
+
db_config = ActiveRecord::Base.configs_for(env_name: "development", spec_name: "primary")
|
927
|
+
db_config.spec_name
|
928
|
+
```
|
960
929
|
|
961
|
-
|
962
|
-
their behavior consistent with `#tables`, `#table_exists?` will check only
|
963
|
-
tables in the future.
|
930
|
+
New behavior:
|
964
931
|
|
965
|
-
|
932
|
+
```ruby
|
933
|
+
db_config = ActiveRecord::Base.configs_for(env_name: "development", name: "primary")
|
934
|
+
db_config.name
|
935
|
+
```
|
966
936
|
|
967
|
-
*
|
937
|
+
*Eileen M. Uchitelle*
|
968
938
|
|
969
|
-
|
970
|
-
to it make easier to validate virtual associations built on top of Active Model
|
971
|
-
objects and/or serialized objects that implement a `valid?` instance method.
|
939
|
+
* Add additional database-specific rake tasks for multi-database users.
|
972
940
|
|
973
|
-
|
941
|
+
Previously, `rails db:create`, `rails db:drop`, and `rails db:migrate` were the only rails tasks that could operate on a single
|
942
|
+
database. For example:
|
974
943
|
|
975
|
-
|
976
|
-
|
944
|
+
```
|
945
|
+
rails db:create
|
946
|
+
rails db:create:primary
|
947
|
+
rails db:create:animals
|
948
|
+
rails db:drop
|
949
|
+
rails db:drop:primary
|
950
|
+
rails db:drop:animals
|
951
|
+
rails db:migrate
|
952
|
+
rails db:migrate:primary
|
953
|
+
rails db:migrate:animals
|
954
|
+
```
|
977
955
|
|
978
|
-
|
956
|
+
With these changes, `rails db:schema:dump`, `rails db:schema:load`, `rails db:structure:dump`, `rails db:structure:load` and
|
957
|
+
`rails db:test:prepare` can additionally operate on a single database. For example:
|
979
958
|
|
980
|
-
|
959
|
+
```
|
960
|
+
rails db:schema:dump
|
961
|
+
rails db:schema:dump:primary
|
962
|
+
rails db:schema:dump:animals
|
963
|
+
rails db:schema:load
|
964
|
+
rails db:schema:load:primary
|
965
|
+
rails db:schema:load:animals
|
966
|
+
rails db:structure:dump
|
967
|
+
rails db:structure:dump:primary
|
968
|
+
rails db:structure:dump:animals
|
969
|
+
rails db:structure:load
|
970
|
+
rails db:structure:load:primary
|
971
|
+
rails db:structure:load:animals
|
972
|
+
rails db:test:prepare
|
973
|
+
rails db:test:prepare:primary
|
974
|
+
rails db:test:prepare:animals
|
975
|
+
```
|
981
976
|
|
982
|
-
|
977
|
+
*Kyle Thompson*
|
983
978
|
|
984
|
-
|
985
|
-
* 20150819202140_irreversible_migration.rb
|
986
|
-
* 20150823202140_add_admin_flag_to_users.rb
|
987
|
-
* 20150823202141_migration_tests.rb
|
988
|
-
* 2_we_need_reminders.rb
|
989
|
-
* 3_innocent_jointable.rb
|
979
|
+
* Add support for `strict_loading` mode on association declarations.
|
990
980
|
|
991
|
-
|
981
|
+
Raise an error if attempting to load a record from an association that has been marked as `strict_loading` unless it was explicitly eager loaded.
|
992
982
|
|
993
|
-
|
994
|
-
...
|
983
|
+
Usage:
|
995
984
|
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
up 003 ********** NO FILE **********
|
1001
|
-
up 20150819202140 Irreversible migration
|
1002
|
-
up 20150823202140 Add admin flag to users
|
1003
|
-
up 20150823202141 Migration tests
|
985
|
+
```ruby
|
986
|
+
class Developer < ApplicationRecord
|
987
|
+
has_many :projects, strict_loading: true
|
988
|
+
end
|
1004
989
|
|
1005
|
-
|
990
|
+
dev = Developer.first
|
991
|
+
dev.projects.first
|
992
|
+
# => ActiveRecord::StrictLoadingViolationError: The projects association is marked as strict_loading and cannot be lazily loaded.
|
993
|
+
```
|
1006
994
|
|
1007
|
-
|
1008
|
-
...
|
995
|
+
*Kevin Deisz*
|
1009
996
|
|
1010
|
-
|
1011
|
-
--------------------------------------------------
|
1012
|
-
up 001 Valid people have last names
|
1013
|
-
up 002 We need reminders
|
1014
|
-
up 003 Innocent jointable
|
1015
|
-
up 20150819202140 Irreversible migration
|
1016
|
-
up 20150823202140 Add admin flag to users
|
1017
|
-
up 20150823202141 Migration tests
|
997
|
+
* Add support for `strict_loading` mode to prevent lazy loading of records.
|
1018
998
|
|
1019
|
-
|
999
|
+
Raise an error if a parent record is marked as `strict_loading` and attempts to lazily load its associations. This is useful for finding places you may want to preload an association and avoid additional queries.
|
1020
1000
|
|
1021
|
-
|
1022
|
-
`preprocess_order_args`.
|
1001
|
+
Usage:
|
1023
1002
|
|
1024
|
-
|
1003
|
+
```ruby
|
1004
|
+
dev = Developer.strict_loading.first
|
1005
|
+
dev.audit_logs.to_a
|
1006
|
+
# => ActiveRecord::StrictLoadingViolationError: Developer is marked as strict_loading and AuditLog cannot be lazily loaded.
|
1007
|
+
```
|
1025
1008
|
|
1026
|
-
*
|
1009
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
1027
1010
|
|
1028
|
-
|
1011
|
+
* Add support for PostgreSQL 11+ partitioned indexes when using `upsert_all`.
|
1029
1012
|
|
1030
|
-
*
|
1013
|
+
*Sebastián Palma*
|
1031
1014
|
|
1032
|
-
|
1033
|
-
Then the choice is the responsibility of the server and MySQL distribution.
|
1015
|
+
* Adds support for `if_not_exists` to `add_column` and `if_exists` to `remove_column`.
|
1034
1016
|
|
1035
|
-
|
1017
|
+
Applications can set their migrations to ignore exceptions raised when adding a column that already exists or when removing a column that does not exist.
|
1036
1018
|
|
1037
|
-
|
1038
|
-
`ActiveRecord::Relation#left_outer_joins`.
|
1019
|
+
Example Usage:
|
1039
1020
|
|
1040
|
-
|
1021
|
+
```ruby
|
1022
|
+
class AddColumnTitle < ActiveRecord::Migration[6.1]
|
1023
|
+
def change
|
1024
|
+
add_column :posts, :title, :string, if_not_exists: true
|
1025
|
+
end
|
1026
|
+
end
|
1027
|
+
```
|
1041
1028
|
|
1042
|
-
|
1043
|
-
|
1029
|
+
```ruby
|
1030
|
+
class RemoveColumnTitle < ActiveRecord::Migration[6.1]
|
1031
|
+
def change
|
1032
|
+
remove_column :posts, :title, if_exists: true
|
1033
|
+
end
|
1034
|
+
end
|
1035
|
+
```
|
1044
1036
|
|
1045
|
-
*
|
1037
|
+
*Eileen M. Uchitelle*
|
1046
1038
|
|
1047
|
-
*
|
1039
|
+
* Regexp-escape table name for MS SQL Server.
|
1048
1040
|
|
1049
|
-
|
1041
|
+
Add `Regexp.escape` to one method in ActiveRecord, so that table names with regular expression characters in them work as expected. Since MS SQL Server uses "[" and "]" to quote table and column names, and those characters are regular expression characters, methods like `pluck` and `select` fail in certain cases when used with the MS SQL Server adapter.
|
1050
1042
|
|
1051
|
-
|
1052
|
-
# => SELECT "users".* FROM "users" LEFT OUTER JOIN "posts" ON
|
1053
|
-
"posts"."user_id" = "users"."id"
|
1043
|
+
*Larry Reid*
|
1054
1044
|
|
1055
|
-
|
1045
|
+
* Store advisory locks on their own named connection.
|
1056
1046
|
|
1057
|
-
|
1047
|
+
Previously advisory locks were taken out against a connection when a migration started. This works fine in single database applications but doesn't work well when migrations need to open new connections which results in the lock getting dropped.
|
1058
1048
|
|
1059
|
-
|
1049
|
+
In order to fix this we are storing the advisory lock on a new connection with the connection specification name `AdvisoryLockBase`. The caveat is that we need to maintain at least 2 connections to a database while migrations are running in order to do this.
|
1060
1050
|
|
1061
|
-
*
|
1062
|
-
`standard_conforming_strings` setting. Errors were previously disabled because
|
1063
|
-
the setting wasn't writable in Postgres 8.1 and didn't exist in earlier
|
1064
|
-
versions. Now Rails only supports Postgres 8.2+ we're fine to assume the
|
1065
|
-
setting exists. Disabling errors caused problems when using a connection
|
1066
|
-
pooling tool like PgBouncer because it's not guaranteed to have the same
|
1067
|
-
connection between calls to `execute` and it could leave the connection
|
1068
|
-
with errors disabled.
|
1051
|
+
*Eileen M. Uchitelle*, *John Crepezzi*
|
1069
1052
|
|
1070
|
-
|
1053
|
+
* Allow schema cache path to be defined in the database configuration file.
|
1071
1054
|
|
1072
|
-
|
1055
|
+
For example:
|
1073
1056
|
|
1074
|
-
|
1057
|
+
```yaml
|
1058
|
+
development:
|
1059
|
+
adapter: postgresql
|
1060
|
+
database: blog_development
|
1061
|
+
pool: 5
|
1062
|
+
schema_cache_path: tmp/schema/main.yml
|
1063
|
+
```
|
1075
1064
|
|
1076
|
-
|
1065
|
+
*Katrina Owen*
|
1077
1066
|
|
1078
|
-
|
1067
|
+
* Deprecate `#remove_connection` in favor of `#remove_connection_pool` when called on the handler.
|
1079
1068
|
|
1080
|
-
|
1069
|
+
`#remove_connection` is deprecated in order to support returning a `DatabaseConfig` object instead of a `Hash`. Use `#remove_connection_pool`, `#remove_connection` will be removed in 6.2.
|
1081
1070
|
|
1082
|
-
|
1071
|
+
*Eileen M. Uchitelle*, *John Crepezzi*
|
1083
1072
|
|
1084
|
-
|
1073
|
+
* Deprecate `#default_hash` and it's alias `#[]` on database configurations.
|
1085
1074
|
|
1086
|
-
|
1087
|
-
has_one :position, dependent: :destroy
|
1088
|
-
end
|
1075
|
+
Applications should use `configs_for`. `#default_hash` and `#[]` will be removed in 6.2.
|
1089
1076
|
|
1090
|
-
|
1091
|
-
belongs_to :content, dependent: :destroy
|
1092
|
-
end
|
1077
|
+
*Eileen M. Uchitelle*, *John Crepezzi*
|
1093
1078
|
|
1094
|
-
|
1079
|
+
* Add scale support to `ActiveRecord::Validations::NumericalityValidator`.
|
1095
1080
|
|
1096
|
-
*
|
1097
|
-
only instantiates one HABTM object because the join table hasn't a primary key.
|
1081
|
+
*Gannon McGibbon*
|
1098
1082
|
|
1099
|
-
|
1083
|
+
* Find orphans by looking for missing relations through chaining `where.missing`:
|
1100
1084
|
|
1101
|
-
|
1085
|
+
Before:
|
1102
1086
|
|
1103
|
-
|
1087
|
+
```ruby
|
1088
|
+
Post.left_joins(:author).where(authors: { id: nil })
|
1089
|
+
```
|
1104
1090
|
|
1105
|
-
|
1106
|
-
Project.includes(:salaried_developers).first.salaried_developers.size # => 1
|
1091
|
+
After:
|
1107
1092
|
|
1108
|
-
|
1093
|
+
```ruby
|
1094
|
+
Post.where.missing(:author)
|
1095
|
+
```
|
1109
1096
|
|
1110
|
-
|
1111
|
-
Project.includes(:salaried_developers).first.salaried_developers.size # => 3
|
1097
|
+
*Tom Rossi*
|
1112
1098
|
|
1113
|
-
|
1099
|
+
* Ensure `:reading` connections always raise if a write is attempted.
|
1114
1100
|
|
1115
|
-
|
1101
|
+
Now Rails will raise an `ActiveRecord::ReadOnlyError` if any connection on the reading handler attempts to make a write. If your reading role needs to write you should name the role something other than `:reading`.
|
1116
1102
|
|
1117
|
-
|
1118
|
-
now be indexed if `:index_errors` option is set to true when defining a
|
1119
|
-
`has_many` relationship or by setting the configuration option
|
1120
|
-
`config.active_record.index_nested_attribute_errors` to true.
|
1103
|
+
*Eileen M. Uchitelle*
|
1121
1104
|
|
1122
|
-
|
1105
|
+
* Deprecate `"primary"` as the `connection_specification_name` for `ActiveRecord::Base`.
|
1123
1106
|
|
1124
|
-
|
1125
|
-
has_many :tuning_pegs, index_errors: true
|
1126
|
-
accepts_nested_attributes_for :tuning_pegs
|
1127
|
-
end
|
1107
|
+
`"primary"` has been deprecated as the `connection_specification_name` for `ActiveRecord::Base` in favor of using `"ActiveRecord::Base"`. This change affects calls to `ActiveRecord::Base.connection_handler.retrieve_connection` and `ActiveRecord::Base.connection_handler.remove_connection`. If you're calling these methods with `"primary"`, please switch to `"ActiveRecord::Base"`.
|
1128
1108
|
|
1129
|
-
|
1130
|
-
belongs_to :guitar
|
1131
|
-
validates_numericality_of :pitch
|
1132
|
-
end
|
1109
|
+
*Eileen M. Uchitelle*, *John Crepezzi*
|
1133
1110
|
|
1134
|
-
|
1135
|
-
|
1111
|
+
* Add `ActiveRecord::Validations::NumericalityValidator` with
|
1112
|
+
support for casting floats using a database columns' precision value.
|
1136
1113
|
|
1137
|
-
|
1138
|
-
guitar.errors["tuning_pegs[1].pitch"] = ["is not a number"]
|
1114
|
+
*Gannon McGibbon*
|
1139
1115
|
|
1140
|
-
|
1116
|
+
* Enforce fresh ETag header after a collection's contents change by adding
|
1117
|
+
ActiveRecord::Relation#cache_key_with_version. This method will be used by
|
1118
|
+
ActionController::ConditionalGet to ensure that when collection cache versioning
|
1119
|
+
is enabled, requests using ConditionalGet don't return the same ETag header
|
1120
|
+
after a collection is modified.
|
1141
1121
|
|
1142
|
-
|
1122
|
+
Fixes #38078.
|
1143
1123
|
|
1144
|
-
*
|
1124
|
+
*Aaron Lipman*
|
1145
1125
|
|
1146
|
-
*
|
1147
|
-
|
1148
|
-
so that when `Computer` and `Monitor` have both `status` columns we don't
|
1149
|
-
have conflicts in projection.
|
1126
|
+
* Skip test database when running `db:create` or `db:drop` in development
|
1127
|
+
with `DATABASE_URL` set.
|
1150
1128
|
|
1151
|
-
*
|
1129
|
+
*Brian Buchalter*
|
1152
1130
|
|
1153
|
-
*
|
1131
|
+
* Don't allow mutations on the database configurations hash.
|
1154
1132
|
|
1155
|
-
|
1133
|
+
Freeze the configurations hash to disallow directly changing it. If applications need to change the hash, for example to create databases for parallelization, they should use the `DatabaseConfig` object directly.
|
1156
1134
|
|
1157
|
-
|
1158
|
-
g.orm :active_record, primary_key_type: :uuid
|
1159
|
-
end
|
1135
|
+
Before:
|
1160
1136
|
|
1161
|
-
|
1137
|
+
```ruby
|
1138
|
+
@db_config = ActiveRecord::Base.configurations.configs_for(env_name: "test", spec_name: "primary")
|
1139
|
+
@db_config.configuration_hash.merge!(idle_timeout: "0.02")
|
1140
|
+
```
|
1162
1141
|
|
1163
|
-
|
1142
|
+
After:
|
1164
1143
|
|
1165
|
-
|
1144
|
+
```ruby
|
1145
|
+
@db_config = ActiveRecord::Base.configurations.configs_for(env_name: "test", spec_name: "primary")
|
1146
|
+
config = @db_config.configuration_hash.merge(idle_timeout: "0.02")
|
1147
|
+
db_config = ActiveRecord::DatabaseConfigurations::HashConfig.new(@db_config.env_name, @db_config.spec_name, config)
|
1148
|
+
```
|
1166
1149
|
|
1167
|
-
*
|
1150
|
+
*Eileen M. Uchitelle*, *John Crepezzi*
|
1168
1151
|
|
1169
|
-
*
|
1152
|
+
* Remove `:connection_id` from the `sql.active_record` notification.
|
1170
1153
|
|
1171
|
-
|
1172
|
-
has `JOIN` with another table which also has a column of the name.
|
1154
|
+
*Aaron Patterson*, *Rafael Mendonça França*
|
1173
1155
|
|
1174
|
-
|
1156
|
+
* The `:name` key will no longer be returned as part of `DatabaseConfig#configuration_hash`. Please use `DatabaseConfig#owner_name` instead.
|
1175
1157
|
|
1176
|
-
*
|
1177
|
-
these queries will change often and are unlikely to have a cache hit.
|
1158
|
+
*Eileen M. Uchitelle*, *John Crepezzi*
|
1178
1159
|
|
1179
|
-
|
1160
|
+
* ActiveRecord's `belongs_to_required_by_default` flag can now be set per model.
|
1180
1161
|
|
1181
|
-
|
1162
|
+
You can now opt-out/opt-in specific models from having their associations required
|
1163
|
+
by default.
|
1182
1164
|
|
1183
|
-
|
1165
|
+
This change is meant to ease the process of migrating all your models to have
|
1166
|
+
their association required.
|
1184
1167
|
|
1185
|
-
*
|
1168
|
+
*Edouard Chin*
|
1186
1169
|
|
1187
|
-
* `
|
1170
|
+
* The `connection_config` method has been deprecated, please use `connection_db_config` instead which will return a `DatabaseConfigurations::DatabaseConfig` instead of a `Hash`.
|
1188
1171
|
|
1189
|
-
|
1172
|
+
*Eileen M. Uchitelle*, *John Crepezzi*
|
1190
1173
|
|
1191
|
-
|
1174
|
+
* Retain explicit selections on the base model after applying `includes` and `joins`.
|
1192
1175
|
|
1193
|
-
|
1194
|
-
not need mutation detection on strings.
|
1176
|
+
Resolves #34889.
|
1195
1177
|
|
1196
|
-
*
|
1178
|
+
*Patrick Rebsch*
|
1197
1179
|
|
1198
|
-
*
|
1199
|
-
passed an `ActiveRecord::Base` instance.
|
1180
|
+
* The `database` kwarg is deprecated without replacement because it can't be used for sharding and creates an issue if it's used during a request. Applications that need to create new connections should use `connects_to` instead.
|
1200
1181
|
|
1201
|
-
|
1182
|
+
*Eileen M. Uchitelle*, *John Crepezzi*
|
1202
1183
|
|
1203
|
-
|
1184
|
+
* Allow attributes to be fetched from Arel node groupings.
|
1204
1185
|
|
1205
|
-
*
|
1206
|
-
`add_reference`.
|
1186
|
+
*Jeff Emminger*, *Gannon McGibbon*
|
1207
1187
|
|
1208
|
-
|
1188
|
+
* A database URL can now contain a querystring value that contains an equal sign. This is needed to support passing PostgreSQL `options`.
|
1209
1189
|
|
1210
|
-
*
|
1190
|
+
*Joshua Flanagan*
|
1211
1191
|
|
1212
|
-
*
|
1192
|
+
* Calling methods like `establish_connection` with a `Hash` which is invalid (eg: no `adapter`) will now raise an error the same way as connections defined in `config/database.yml`.
|
1213
1193
|
|
1214
|
-
*
|
1194
|
+
*John Crepezzi*
|
1215
1195
|
|
1216
|
-
*
|
1217
|
-
are all reflected in the database rather than overwriting each other.
|
1196
|
+
* Specifying `implicit_order_column` now subsorts the records by primary key if available to ensure deterministic results.
|
1218
1197
|
|
1219
|
-
*
|
1198
|
+
*Paweł Urbanek*
|
1220
1199
|
|
1221
|
-
*
|
1200
|
+
* `where(attr => [])` now loads an empty result without making a query.
|
1222
1201
|
|
1223
|
-
|
1202
|
+
*John Hawthorn*
|
1224
1203
|
|
1225
|
-
|
1204
|
+
* Fixed the performance regression for `primary_keys` introduced MySQL 8.0.
|
1226
1205
|
|
1227
|
-
*
|
1206
|
+
*Hiroyuki Ishii*
|
1228
1207
|
|
1229
|
-
|
1208
|
+
* Add support for `belongs_to` to `has_many` inversing.
|
1230
1209
|
|
1231
|
-
*
|
1210
|
+
*Gannon McGibbon*
|
1232
1211
|
|
1233
|
-
|
1212
|
+
* Allow length configuration for `has_secure_token` method. The minimum length
|
1213
|
+
is set at 24 characters.
|
1234
1214
|
|
1235
|
-
|
1236
|
-
model_class: User
|
1237
|
-
david:
|
1238
|
-
name: David
|
1215
|
+
Before:
|
1239
1216
|
|
1240
|
-
|
1217
|
+
```ruby
|
1218
|
+
has_secure_token :auth_token
|
1219
|
+
```
|
1241
1220
|
|
1242
|
-
|
1221
|
+
After:
|
1243
1222
|
|
1244
|
-
|
1245
|
-
|
1223
|
+
```ruby
|
1224
|
+
has_secure_token :default_token # 24 characters
|
1225
|
+
has_secure_token :auth_token, length: 36 # 36 characters
|
1226
|
+
has_secure_token :invalid_token, length: 12 # => ActiveRecord::SecureToken::MinimumLengthError
|
1227
|
+
```
|
1246
1228
|
|
1247
|
-
*
|
1229
|
+
*Bernardo de Araujo*
|
1248
1230
|
|
1249
|
-
*
|
1231
|
+
* Deprecate `DatabaseConfigurations#to_h`. These connection hashes are still available via `ActiveRecord::Base.configurations.configs_for`.
|
1250
1232
|
|
1251
|
-
*
|
1233
|
+
*Eileen Uchitelle*, *John Crepezzi*
|
1252
1234
|
|
1253
|
-
*
|
1235
|
+
* Add `DatabaseConfig#configuration_hash` to return database configuration hashes with symbol keys, and use all symbol-key configuration hashes internally. Deprecate `DatabaseConfig#config` which returns a String-keyed `Hash` with the same values.
|
1254
1236
|
|
1255
|
-
|
1256
|
-
In result in how big a fraction of a second can be stored in the
|
1257
|
-
database.
|
1237
|
+
*John Crepezzi*, *Eileen Uchitelle*
|
1258
1238
|
|
1239
|
+
* Allow column names to be passed to `remove_index` positionally along with other options.
|
1259
1240
|
|
1260
|
-
|
1261
|
-
m.created_at.usec == m.reload.created_at.usec # => false
|
1262
|
-
# due to different precision in Time.now and database column
|
1241
|
+
Passing other options can be necessary to make `remove_index` correctly reversible.
|
1263
1242
|
|
1264
|
-
|
1265
|
-
enough by default) the value changes when model is reloaded from the
|
1266
|
-
database. This patch fixes that issue ensuring that any timestamp
|
1267
|
-
assigned as an attribute is converted to column precision under the
|
1268
|
-
attribute.
|
1243
|
+
Before:
|
1269
1244
|
|
1270
|
-
|
1245
|
+
add_index :reports, :report_id # => works
|
1246
|
+
add_index :reports, :report_id, unique: true # => works
|
1247
|
+
remove_index :reports, :report_id # => works
|
1248
|
+
remove_index :reports, :report_id, unique: true # => ArgumentError
|
1271
1249
|
|
1272
|
-
|
1273
|
-
These methods determine what relations can be used to back Active Record
|
1274
|
-
models (usually tables and views).
|
1250
|
+
After:
|
1275
1251
|
|
1276
|
-
|
1277
|
-
`SchemaCache#clear_table_cache!` in favor of their new data source
|
1278
|
-
counterparts.
|
1252
|
+
remove_index :reports, :report_id, unique: true # => works
|
1279
1253
|
|
1280
|
-
*
|
1254
|
+
*Eugene Kenny*
|
1281
1255
|
|
1282
|
-
*
|
1283
|
-
invisible from Active Record.
|
1256
|
+
* Allow bulk `ALTER` statements to drop and recreate indexes with the same name.
|
1284
1257
|
|
1285
|
-
*
|
1258
|
+
*Eugene Kenny*
|
1286
1259
|
|
1287
|
-
* `
|
1288
|
-
mysql commands (like `mysqldump`) is not successful.
|
1260
|
+
* `insert`, `insert_all`, `upsert`, and `upsert_all` now clear the query cache.
|
1289
1261
|
|
1290
|
-
*
|
1262
|
+
*Eugene Kenny*
|
1291
1263
|
|
1292
|
-
*
|
1264
|
+
* Call `while_preventing_writes` directly from `connected_to`.
|
1293
1265
|
|
1294
|
-
|
1266
|
+
In some cases application authors want to use the database switching middleware and make explicit calls with `connected_to`. It's possible for an app to turn off writes and not turn them back on by the time we call `connected_to(role: :writing)`.
|
1295
1267
|
|
1296
|
-
|
1268
|
+
This change allows apps to fix this by assuming if a role is writing we want to allow writes, except in the case it's explicitly turned off.
|
1297
1269
|
|
1298
|
-
*
|
1270
|
+
*Eileen M. Uchitelle*
|
1299
1271
|
|
1300
|
-
|
1272
|
+
* Improve detection of ActiveRecord::StatementTimeout with mysql2 adapter in the edge case when the query is terminated during filesort.
|
1301
1273
|
|
1302
|
-
|
1303
|
-
t.unsigned_integer :quantity
|
1304
|
-
t.unsigned_bigint :total
|
1305
|
-
t.unsigned_float :percentage
|
1306
|
-
t.unsigned_decimal :price, precision: 10, scale: 2
|
1307
|
-
end
|
1274
|
+
*Kir Shatrov*
|
1308
1275
|
|
1309
|
-
|
1276
|
+
* Stop trying to read yaml file fixtures when loading Active Record fixtures.
|
1310
1277
|
|
1311
|
-
|
1312
|
-
…
|
1313
|
-
end
|
1278
|
+
*Gannon McGibbon*
|
1314
1279
|
|
1315
|
-
|
1280
|
+
* Deprecate `.reorder(nil)` with `.first` / `.first!` taking non-deterministic result.
|
1316
1281
|
|
1317
|
-
|
1282
|
+
To continue taking non-deterministic result, use `.take` / `.take!` instead.
|
1318
1283
|
|
1319
1284
|
*Ryuta Kamizono*
|
1320
1285
|
|
1321
|
-
*
|
1322
|
-
|
1323
|
-
Example:
|
1286
|
+
* Preserve user supplied joins order as much as possible.
|
1324
1287
|
|
1325
|
-
|
1326
|
-
t.string :region
|
1327
|
-
t.integer :code
|
1328
|
-
end
|
1288
|
+
Fixes #36761, #34328, #24281, #12953.
|
1329
1289
|
|
1330
1290
|
*Ryuta Kamizono*
|
1331
1291
|
|
1332
|
-
*
|
1333
|
-
model class that defines the association.
|
1334
|
-
|
1335
|
-
*kuboon*, *Ronak Jangir*
|
1336
|
-
|
1337
|
-
* Correct query for PostgreSQL 8.2 compatibility.
|
1338
|
-
|
1339
|
-
*Ben Murphy*, *Matthew Draper*
|
1340
|
-
|
1341
|
-
* `bin/rails db:migrate` uses
|
1342
|
-
`ActiveRecord::Tasks::DatabaseTasks.migrations_paths` instead of
|
1343
|
-
`Migrator.migrations_paths`.
|
1344
|
-
|
1345
|
-
*Tobias Bielohlawek*
|
1346
|
-
|
1347
|
-
* Support dropping indexes concurrently in PostgreSQL.
|
1348
|
-
|
1349
|
-
See http://www.postgresql.org/docs/9.4/static/sql-dropindex.html for more
|
1350
|
-
details.
|
1351
|
-
|
1352
|
-
*Grey Baker*
|
1353
|
-
|
1354
|
-
* Deprecate passing conditions to `ActiveRecord::Relation#delete_all`
|
1355
|
-
and `ActiveRecord::Relation#destroy_all`.
|
1356
|
-
|
1357
|
-
*Wojciech Wnętrzak*
|
1358
|
-
|
1359
|
-
* Instantiating an AR model with `ActionController::Parameters` now raises
|
1360
|
-
an `ActiveModel::ForbiddenAttributesError` if the parameters include a
|
1361
|
-
`type` field that has not been explicitly permitted. Previously, the
|
1362
|
-
`type` field was simply ignored in the same situation.
|
1363
|
-
|
1364
|
-
*Prem Sichanugrist*
|
1365
|
-
|
1366
|
-
* PostgreSQL, `create_schema`, `drop_schema` and `rename_table` now quote
|
1367
|
-
schema names.
|
1368
|
-
|
1369
|
-
Fixes #21418.
|
1292
|
+
* Allow `matches_regex` and `does_not_match_regexp` on the MySQL Arel visitor.
|
1370
1293
|
|
1371
|
-
|
1372
|
-
|
1373
|
-
create_schema("my.schema")
|
1374
|
-
# CREATE SCHEMA "my.schema";
|
1375
|
-
|
1376
|
-
*Yves Senn*
|
1377
|
-
|
1378
|
-
* PostgreSQL, add `:if_exists` option to `#drop_schema`. This makes it
|
1379
|
-
possible to drop a schema that might exist without raising an exception if
|
1380
|
-
it doesn't.
|
1381
|
-
|
1382
|
-
*Yves Senn*
|
1383
|
-
|
1384
|
-
* Only try to nullify has_one target association if the record is persisted.
|
1385
|
-
|
1386
|
-
Fixes #21223.
|
1387
|
-
|
1388
|
-
*Agis Anastasopoulos*
|
1294
|
+
*James Pearson*
|
1389
1295
|
|
1390
|
-
*
|
1391
|
-
record without primary key.
|
1296
|
+
* Allow specifying fixtures to be ignored by setting `ignore` in YAML file's '_fixture' section.
|
1392
1297
|
|
1393
|
-
|
1298
|
+
*Tongfei Gao*
|
1394
1299
|
|
1395
|
-
|
1300
|
+
* Make the DATABASE_URL env variable only affect the primary connection. Add new env variables for multiple databases.
|
1396
1301
|
|
1397
|
-
*
|
1302
|
+
*John Crepezzi*, *Eileen Uchitelle*
|
1398
1303
|
|
1399
|
-
|
1304
|
+
* Add a warning for enum elements with 'not_' prefix.
|
1400
1305
|
|
1401
|
-
|
1402
|
-
|
1306
|
+
class Foo
|
1307
|
+
enum status: [:sent, :not_sent]
|
1403
1308
|
end
|
1404
1309
|
|
1405
|
-
*
|
1406
|
-
|
1407
|
-
* Descriptive error message when fixtures contain a missing column.
|
1408
|
-
|
1409
|
-
Fixes #21201.
|
1310
|
+
*Edu Depetris*
|
1410
1311
|
|
1411
|
-
|
1312
|
+
* Make currency symbols optional for money column type in PostgreSQL.
|
1412
1313
|
|
1413
|
-
*
|
1414
|
-
postgresql commands (like `pg_dump`) is not successful.
|
1314
|
+
*Joel Schneider*
|
1415
1315
|
|
1416
|
-
|
1316
|
+
* Add support for beginless ranges, introduced in Ruby 2.7.
|
1417
1317
|
|
1418
|
-
*
|
1419
|
-
in batches.
|
1318
|
+
*Josh Goodall*
|
1420
1319
|
|
1421
|
-
|
1320
|
+
* Add `database_exists?` method to connection adapters to check if a database exists.
|
1422
1321
|
|
1423
|
-
|
1322
|
+
*Guilherme Mansur*
|
1424
1323
|
|
1425
|
-
|
1426
|
-
Person.in_batches.update_all(awesome: true)
|
1427
|
-
Person.in_batches.delete_all
|
1428
|
-
Person.in_batches.each do |relation|
|
1429
|
-
relation.delete_all
|
1430
|
-
sleep 10 # Throttles the delete queries
|
1431
|
-
end
|
1324
|
+
* Loading the schema for a model that has no `table_name` raises a `TableNotSpecified` error.
|
1432
1325
|
|
1433
|
-
|
1326
|
+
*Guilherme Mansur*, *Eugene Kenny*
|
1434
1327
|
|
1435
|
-
|
1328
|
+
* PostgreSQL: Fix GROUP BY with ORDER BY virtual count attribute.
|
1436
1329
|
|
1437
|
-
|
1330
|
+
Fixes #36022.
|
1438
1331
|
|
1439
|
-
|
1332
|
+
*Ryuta Kamizono*
|
1440
1333
|
|
1441
|
-
|
1442
|
-
t.line :foo_line
|
1443
|
-
t.lseg :foo_lseg
|
1444
|
-
t.box :foo_box
|
1445
|
-
t.path :foo_path
|
1446
|
-
t.polygon :foo_polygon
|
1447
|
-
t.circle :foo_circle
|
1448
|
-
end
|
1334
|
+
* Make ActiveRecord `ConnectionPool.connections` method thread-safe.
|
1449
1335
|
|
1450
|
-
|
1336
|
+
Fixes #36465.
|
1451
1337
|
|
1452
|
-
*
|
1338
|
+
*Jeff Doering*
|
1453
1339
|
|
1454
|
-
|
1455
|
-
|
1456
|
-
@users = User.where("name like ?", "%Alberto%")
|
1457
|
-
@users.cache_key
|
1458
|
-
# => "/users/query-5942b155a43b139f2471b872ac54251f-3-20150714212107656125000"
|
1459
|
-
|
1460
|
-
*Alberto Fernández-Capel*
|
1461
|
-
|
1462
|
-
* Properly allow uniqueness validations on primary keys.
|
1463
|
-
|
1464
|
-
Fixes #20966.
|
1465
|
-
|
1466
|
-
*Sean Griffin*, *presskey*
|
1467
|
-
|
1468
|
-
* Don't raise an error if an association failed to destroy when `destroy` was
|
1469
|
-
called on the parent (as opposed to `destroy!`).
|
1470
|
-
|
1471
|
-
Fixes #20991.
|
1472
|
-
|
1473
|
-
*Sean Griffin*
|
1474
|
-
|
1475
|
-
* `ActiveRecord::RecordNotFound` modified to store model name, primary_key and
|
1476
|
-
id of the caller model. It allows the catcher of this exception to make
|
1477
|
-
a better decision to what to do with it.
|
1478
|
-
|
1479
|
-
Example:
|
1480
|
-
|
1481
|
-
class SomeAbstractController < ActionController::Base
|
1482
|
-
rescue_from ActiveRecord::RecordNotFound, with: :redirect_to_404
|
1483
|
-
|
1484
|
-
private def redirect_to_404(e)
|
1485
|
-
return redirect_to(posts_url) if e.model == 'Post'
|
1486
|
-
raise
|
1487
|
-
end
|
1488
|
-
end
|
1489
|
-
|
1490
|
-
*Sameer Rahmani*
|
1491
|
-
|
1492
|
-
* Deprecate the keys for association `restrict_dependent_destroy` errors in favor
|
1493
|
-
of new key names.
|
1494
|
-
|
1495
|
-
Previously `has_one` and `has_many` associations were using the
|
1496
|
-
`one` and `many` keys respectively. Both of these keys have special
|
1497
|
-
meaning in I18n (they are considered to be pluralizations) so by
|
1498
|
-
renaming them to `has_one` and `has_many` we make the messages more explicit
|
1499
|
-
and most importantly they don't clash with linguistical systems that need to
|
1500
|
-
validate translation keys (and their pluralizations).
|
1501
|
-
|
1502
|
-
The `:'restrict_dependent_destroy.one'` key should be replaced with
|
1503
|
-
`:'restrict_dependent_destroy.has_one'`, and `:'restrict_dependent_destroy.many'`
|
1504
|
-
with `:'restrict_dependent_destroy.has_many'`.
|
1505
|
-
|
1506
|
-
*Roque Pinel*, *Christopher Dell*
|
1507
|
-
|
1508
|
-
* Fix state being carried over from previous transaction.
|
1509
|
-
|
1510
|
-
Considering the following example where `name` is a required attribute.
|
1511
|
-
Before we had `new_record?` returning `true` for a persisted record:
|
1512
|
-
|
1513
|
-
author = Author.create! name: 'foo'
|
1514
|
-
author.name = nil
|
1515
|
-
author.save # => false
|
1516
|
-
author.new_record? # => true
|
1517
|
-
|
1518
|
-
Fixes #20824.
|
1519
|
-
|
1520
|
-
*Roque Pinel*
|
1521
|
-
|
1522
|
-
* Correctly ignore `mark_for_destruction` when `autosave` isn't set to `true`
|
1523
|
-
when validating associations.
|
1524
|
-
|
1525
|
-
Fixes #20882.
|
1526
|
-
|
1527
|
-
*Sean Griffin*
|
1528
|
-
|
1529
|
-
* Fix a bug where counter_cache doesn't always work with polymorphic
|
1530
|
-
relations.
|
1531
|
-
|
1532
|
-
Fixes #16407.
|
1533
|
-
|
1534
|
-
*Stefan Kanev*, *Sean Griffin*
|
1535
|
-
|
1536
|
-
* Ensure that cyclic associations with autosave don't cause duplicate errors
|
1537
|
-
to be added to the parent record.
|
1538
|
-
|
1539
|
-
Fixes #20874.
|
1540
|
-
|
1541
|
-
*Sean Griffin*
|
1542
|
-
|
1543
|
-
* Ensure that `ActionController::Parameters` can still be passed to nested
|
1544
|
-
attributes.
|
1545
|
-
|
1546
|
-
Fixes #20922.
|
1547
|
-
|
1548
|
-
*Sean Griffin*
|
1549
|
-
|
1550
|
-
* Deprecate force association reload by passing a truthy argument to
|
1551
|
-
association method.
|
1552
|
-
|
1553
|
-
For collection association, you can call `#reload` on association proxy to
|
1554
|
-
force a reload:
|
1555
|
-
|
1556
|
-
@user.posts.reload # Instead of @user.posts(true)
|
1557
|
-
|
1558
|
-
For singular association, you can call `#reload` on the parent object to
|
1559
|
-
clear its association cache then call the association method:
|
1560
|
-
|
1561
|
-
@user.reload.profile # Instead of @user.profile(true)
|
1562
|
-
|
1563
|
-
Passing a truthy argument to force association to reload will be removed in
|
1564
|
-
Rails 5.1.
|
1565
|
-
|
1566
|
-
*Prem Sichanugrist*
|
1567
|
-
|
1568
|
-
* Replaced `ActiveSupport::Concurrency::Latch` with `Concurrent::CountDownLatch`
|
1569
|
-
from the concurrent-ruby gem.
|
1570
|
-
|
1571
|
-
*Jerry D'Antonio*
|
1572
|
-
|
1573
|
-
* Fix through associations using scopes having the scope merged multiple
|
1574
|
-
times.
|
1575
|
-
|
1576
|
-
Fixes #20721.
|
1577
|
-
Fixes #20727.
|
1578
|
-
|
1579
|
-
*Sean Griffin*
|
1580
|
-
|
1581
|
-
* `ActiveRecord::Base.dump_schema_after_migration` applies migration tasks
|
1582
|
-
other than `db:migrate`. (eg. `db:rollback`, `db:migrate:dup`, ...)
|
1583
|
-
|
1584
|
-
Fixes #20743.
|
1585
|
-
|
1586
|
-
*Yves Senn*
|
1587
|
-
|
1588
|
-
* Add alternate syntax to make `change_column_default` reversible.
|
1589
|
-
|
1590
|
-
User can pass in `:from` and `:to` to make `change_column_default` command
|
1591
|
-
become reversible.
|
1592
|
-
|
1593
|
-
Example:
|
1594
|
-
|
1595
|
-
change_column_default :posts, :status, from: nil, to: "draft"
|
1596
|
-
change_column_default :users, :authorized, from: true, to: false
|
1597
|
-
|
1598
|
-
*Prem Sichanugrist*
|
1599
|
-
|
1600
|
-
* Prevent error when using `force_reload: true` on an unassigned polymorphic
|
1601
|
-
belongs_to association.
|
1602
|
-
|
1603
|
-
Fixes #20426.
|
1604
|
-
|
1605
|
-
*James Dabbs*
|
1606
|
-
|
1607
|
-
* Correctly raise `ActiveRecord::AssociationTypeMismatch` when assigning
|
1608
|
-
a wrong type to a namespaced association.
|
1609
|
-
|
1610
|
-
Fixes #20545.
|
1611
|
-
|
1612
|
-
*Diego Carrion*
|
1613
|
-
|
1614
|
-
* `validates_absence_of` respects `marked_for_destruction?`.
|
1615
|
-
|
1616
|
-
Fixes #20449.
|
1617
|
-
|
1618
|
-
*Yves Senn*
|
1619
|
-
|
1620
|
-
* Include the `Enumerable` module in `ActiveRecord::Relation`
|
1621
|
-
|
1622
|
-
*Sean Griffin*, *bogdan*
|
1623
|
-
|
1624
|
-
* Use `Enumerable#sum` in `ActiveRecord::Relation` if a block is given.
|
1625
|
-
|
1626
|
-
*Sean Griffin*
|
1627
|
-
|
1628
|
-
* Let `WITH` queries (Common Table Expressions) be explainable.
|
1629
|
-
|
1630
|
-
*Vladimir Kochnev*
|
1631
|
-
|
1632
|
-
* Make `remove_index :table, :column` reversible.
|
1633
|
-
|
1634
|
-
*Yves Senn*
|
1635
|
-
|
1636
|
-
* Fixed an error which would occur in dirty checking when calling
|
1637
|
-
`update_attributes` from a getter.
|
1638
|
-
|
1639
|
-
Fixes #20531.
|
1640
|
-
|
1641
|
-
*Sean Griffin*
|
1642
|
-
|
1643
|
-
* Make `remove_foreign_key` reversible. Any foreign key options must be
|
1644
|
-
specified, similar to `remove_column`.
|
1645
|
-
|
1646
|
-
*Aster Ryan*
|
1647
|
-
|
1648
|
-
* Add `:_prefix` and `:_suffix` options to `enum` definition.
|
1649
|
-
|
1650
|
-
Fixes #17511, #17415.
|
1651
|
-
|
1652
|
-
*Igor Kapkov*
|
1653
|
-
|
1654
|
-
* Correctly handle decimal arrays with defaults in the schema dumper.
|
1655
|
-
|
1656
|
-
Fixes #20515.
|
1657
|
-
|
1658
|
-
*Sean Griffin*, *jmondo*
|
1659
|
-
|
1660
|
-
* Deprecate the PostgreSQL `:point` type in favor of a new one which will return
|
1661
|
-
`Point` objects instead of an `Array`
|
1662
|
-
|
1663
|
-
*Sean Griffin*
|
1664
|
-
|
1665
|
-
* Ensure symbols passed to `ActiveRecord::Relation#select` are always treated
|
1666
|
-
as columns.
|
1667
|
-
|
1668
|
-
Fixes #20360.
|
1669
|
-
|
1670
|
-
*Sean Griffin*
|
1671
|
-
|
1672
|
-
* Do not set `sql_mode` if `strict: :default` is specified.
|
1673
|
-
|
1674
|
-
# config/database.yml
|
1675
|
-
production:
|
1676
|
-
adapter: mysql2
|
1677
|
-
database: foo_prod
|
1678
|
-
user: foo
|
1679
|
-
strict: :default
|
1680
|
-
|
1681
|
-
*Ryuta Kamizono*
|
1682
|
-
|
1683
|
-
* Allow proc defaults to be passed to the attributes API. See documentation
|
1684
|
-
for examples.
|
1685
|
-
|
1686
|
-
*Sean Griffin*, *Kir Shatrov*
|
1687
|
-
|
1688
|
-
* SQLite: `:collation` support for string and text columns.
|
1689
|
-
|
1690
|
-
Example:
|
1691
|
-
|
1692
|
-
create_table :foo do |t|
|
1693
|
-
t.string :string_nocase, collation: 'NOCASE'
|
1694
|
-
t.text :text_rtrim, collation: 'RTRIM'
|
1695
|
-
end
|
1696
|
-
|
1697
|
-
add_column :foo, :title, :string, collation: 'RTRIM'
|
1698
|
-
|
1699
|
-
change_column :foo, :title, :string, collation: 'NOCASE'
|
1700
|
-
|
1701
|
-
*Akshay Vishnoi*
|
1702
|
-
|
1703
|
-
* Allow the use of symbols or strings to specify enum values in test
|
1704
|
-
fixtures:
|
1705
|
-
|
1706
|
-
awdr:
|
1707
|
-
title: "Agile Web Development with Rails"
|
1708
|
-
status: :proposed
|
1709
|
-
|
1710
|
-
*George Claghorn*
|
1711
|
-
|
1712
|
-
* Clear query cache when `ActiveRecord::Base#reload` is called.
|
1713
|
-
|
1714
|
-
*Shane Hender, Pierre Nespo*
|
1715
|
-
|
1716
|
-
* Include stored procedures and function on the MySQL structure dump.
|
1717
|
-
|
1718
|
-
*Jonathan Worek*
|
1719
|
-
|
1720
|
-
* Pass `:extend` option for `has_and_belongs_to_many` associations to the
|
1721
|
-
underlying `has_many :through`.
|
1722
|
-
|
1723
|
-
*Jaehyun Shin*
|
1724
|
-
|
1725
|
-
* Deprecate `Relation#uniq` use `Relation#distinct` instead.
|
1726
|
-
|
1727
|
-
See #9683.
|
1728
|
-
|
1729
|
-
*Yves Senn*
|
1730
|
-
|
1731
|
-
* Allow single table inheritance instantiation to work when storing
|
1732
|
-
demodulized class names.
|
1733
|
-
|
1734
|
-
*Alex Robbin*
|
1735
|
-
|
1736
|
-
* Correctly pass MySQL options when using `structure_dump` or
|
1737
|
-
`structure_load`.
|
1738
|
-
|
1739
|
-
Specifically, it fixes an issue when using SSL authentication.
|
1740
|
-
|
1741
|
-
*Alex Coomans*
|
1742
|
-
|
1743
|
-
* Correctly dump `:options` on `create_table` for MySQL.
|
1744
|
-
|
1745
|
-
*Ryuta Kamizono*
|
1746
|
-
|
1747
|
-
* PostgreSQL: `:collation` support for string and text columns.
|
1748
|
-
|
1749
|
-
Example:
|
1750
|
-
|
1751
|
-
create_table :foos do |t|
|
1752
|
-
t.string :string_en, collation: 'en_US.UTF-8'
|
1753
|
-
t.text :text_ja, collation: 'ja_JP.UTF-8'
|
1754
|
-
end
|
1755
|
-
|
1756
|
-
*Ryuta Kamizono*
|
1757
|
-
|
1758
|
-
* Remove `ActiveRecord::Serialization::XmlSerializer` from core.
|
1759
|
-
|
1760
|
-
*Zachary Scott*
|
1761
|
-
|
1762
|
-
* Make `unscope` aware of "less than" and "greater than" conditions.
|
1763
|
-
|
1764
|
-
*TAKAHASHI Kazuaki*
|
1765
|
-
|
1766
|
-
* `find_by` and `find_by!` raise `ArgumentError` when called without
|
1767
|
-
arguments.
|
1768
|
-
|
1769
|
-
*Kohei Suzuki*
|
1770
|
-
|
1771
|
-
* Revert behavior of `db:schema:load` back to loading the full
|
1772
|
-
environment. This ensures that initializers are run.
|
1773
|
-
|
1774
|
-
Fixes #19545.
|
1775
|
-
|
1776
|
-
*Yves Senn*
|
1777
|
-
|
1778
|
-
* Fix missing index when using `timestamps` with the `index` option.
|
1779
|
-
|
1780
|
-
The `index` option used with `timestamps` should be passed to both
|
1781
|
-
`column` definitions for `created_at` and `updated_at` rather than just
|
1782
|
-
the first.
|
1783
|
-
|
1784
|
-
*Paul Mucur*
|
1785
|
-
|
1786
|
-
* Rename `:class` to `:anonymous_class` in association options.
|
1787
|
-
|
1788
|
-
Fixes #19659.
|
1789
|
-
|
1790
|
-
*Andrew White*
|
1791
|
-
|
1792
|
-
* Autosave existing records on a has many through association when the parent
|
1793
|
-
is new.
|
1794
|
-
|
1795
|
-
Fixes #19782.
|
1796
|
-
|
1797
|
-
*Sean Griffin*
|
1798
|
-
|
1799
|
-
* Fixed a bug where uniqueness validations would error on out of range values,
|
1800
|
-
even if an validation should have prevented it from hitting the database.
|
1801
|
-
|
1802
|
-
*Andrey Voronkov*
|
1803
|
-
|
1804
|
-
* MySQL: `:charset` and `:collation` support for string and text columns.
|
1805
|
-
|
1806
|
-
Example:
|
1807
|
-
|
1808
|
-
create_table :foos do |t|
|
1809
|
-
t.string :string_utf8_bin, charset: 'utf8', collation: 'utf8_bin'
|
1810
|
-
t.text :text_ascii, charset: 'ascii'
|
1811
|
-
end
|
1812
|
-
|
1813
|
-
*Ryuta Kamizono*
|
1814
|
-
|
1815
|
-
* Foreign key related methods in the migration DSL respect
|
1816
|
-
`ActiveRecord::Base.pluralize_table_names = false`.
|
1817
|
-
|
1818
|
-
Fixes #19643.
|
1819
|
-
|
1820
|
-
*Mehmet Emin İNAÇ*
|
1821
|
-
|
1822
|
-
* Reduce memory usage from loading types on PostgreSQL.
|
1823
|
-
|
1824
|
-
Fixes #19578.
|
1825
|
-
|
1826
|
-
*Sean Griffin*
|
1827
|
-
|
1828
|
-
* Add `config.active_record.warn_on_records_fetched_greater_than` option.
|
1829
|
-
|
1830
|
-
When set to an integer, a warning will be logged whenever a result set
|
1831
|
-
larger than the specified size is returned by a query.
|
1832
|
-
|
1833
|
-
Fixes #16463.
|
1834
|
-
|
1835
|
-
*Jason Nochlin*
|
1836
|
-
|
1837
|
-
* Ignore `.psqlrc` when loading database structure.
|
1838
|
-
|
1839
|
-
*Jason Weathered*
|
1840
|
-
|
1841
|
-
* Fix referencing wrong table aliases while joining tables of has many through
|
1842
|
-
association (only when calling calculation methods).
|
1843
|
-
|
1844
|
-
Fixes #19276.
|
1845
|
-
|
1846
|
-
*pinglamb*
|
1847
|
-
|
1848
|
-
* Correctly persist a serialized attribute that has been returned to
|
1849
|
-
its default value by an in-place modification.
|
1850
|
-
|
1851
|
-
Fixes #19467.
|
1852
|
-
|
1853
|
-
*Matthew Draper*
|
1854
|
-
|
1855
|
-
* Fix generating the schema file when using PostgreSQL `BigInt[]` data type.
|
1856
|
-
Previously the `limit: 8` was not coming through, and this caused it to
|
1857
|
-
become `Int[]` data type after rebuilding from the schema.
|
1858
|
-
|
1859
|
-
Fixes #19420.
|
1860
|
-
|
1861
|
-
*Jake Waller*
|
1862
|
-
|
1863
|
-
* Reuse the `CollectionAssociation#reader` cache when the foreign key is
|
1864
|
-
available prior to save.
|
1865
|
-
|
1866
|
-
*Ben Woosley*
|
1867
|
-
|
1868
|
-
* Add `config.active_record.dump_schemas` to fix `db:structure:dump`
|
1869
|
-
when using schema_search_path and PostgreSQL extensions.
|
1870
|
-
|
1871
|
-
Fixes #17157.
|
1872
|
-
|
1873
|
-
*Ryan Wallace*
|
1874
|
-
|
1875
|
-
* Renaming `use_transactional_fixtures` to `use_transactional_tests` for clarity.
|
1876
|
-
|
1877
|
-
Fixes #18864.
|
1878
|
-
|
1879
|
-
*Brandon Weiss*
|
1880
|
-
|
1881
|
-
* Increase pg gem version requirement to `~> 0.18`. Earlier versions of the
|
1882
|
-
pg gem are known to have problems with Ruby 2.2.
|
1883
|
-
|
1884
|
-
*Matt Brictson*
|
1885
|
-
|
1886
|
-
* Correctly dump `serial` and `bigserial`.
|
1887
|
-
|
1888
|
-
*Ryuta Kamizono*
|
1889
|
-
|
1890
|
-
* Fix default `format` value in `ActiveRecord::Tasks::DatabaseTasks#schema_file`.
|
1891
|
-
|
1892
|
-
*James Cox*
|
1893
|
-
|
1894
|
-
* Don't enroll records in the transaction if they don't have commit callbacks.
|
1895
|
-
This was causing a memory leak when creating many records inside a transaction.
|
1896
|
-
|
1897
|
-
Fixes #15549.
|
1898
|
-
|
1899
|
-
*Will Bryant*, *Aaron Patterson*
|
1900
|
-
|
1901
|
-
* Correctly create through records when created on a has many through
|
1902
|
-
association when using `where`.
|
1903
|
-
|
1904
|
-
Fixes #19073.
|
1905
|
-
|
1906
|
-
*Sean Griffin*
|
1907
|
-
|
1908
|
-
* Add `SchemaMigration.create_table` support for any unicode charsets with MySQL.
|
1909
|
-
|
1910
|
-
*Ryuta Kamizono*
|
1911
|
-
|
1912
|
-
* PostgreSQL no longer disables user triggers if system triggers can't be
|
1913
|
-
disabled. Disabling user triggers does not fulfill what the method promises.
|
1914
|
-
Rails currently requires superuser privileges for this method.
|
1915
|
-
|
1916
|
-
If you absolutely rely on this behavior, consider patching
|
1917
|
-
`disable_referential_integrity`.
|
1918
|
-
|
1919
|
-
*Yves Senn*
|
1920
|
-
|
1921
|
-
* Restore aborted transaction state when `disable_referential_integrity` fails
|
1922
|
-
due to missing permissions.
|
1923
|
-
|
1924
|
-
*Toby Ovod-Everett*, *Yves Senn*
|
1925
|
-
|
1926
|
-
* In PostgreSQL, print a warning message if `disable_referential_integrity`
|
1927
|
-
fails due to missing permissions.
|
1928
|
-
|
1929
|
-
*Andrey Nering*, *Yves Senn*
|
1930
|
-
|
1931
|
-
* Allow a `:limit` option for MySQL bigint primary key support.
|
1932
|
-
|
1933
|
-
Example:
|
1934
|
-
|
1935
|
-
create_table :foos, id: :primary_key, limit: 8 do |t|
|
1936
|
-
end
|
1937
|
-
|
1938
|
-
# or
|
1939
|
-
|
1940
|
-
create_table :foos, id: false do |t|
|
1941
|
-
t.primary_key :id, limit: 8
|
1942
|
-
end
|
1943
|
-
|
1944
|
-
*Ryuta Kamizono*
|
1945
|
-
|
1946
|
-
* `belongs_to` will now trigger a validation error by default if the association is not present.
|
1947
|
-
You can turn this off on a per-association basis with `optional: true`.
|
1948
|
-
(Note this new default only applies to new Rails apps that will be generated with
|
1949
|
-
`config.active_record.belongs_to_required_by_default = true` in initializer.)
|
1950
|
-
|
1951
|
-
*Josef Šimánek*
|
1952
|
-
|
1953
|
-
* Fixed `ActiveRecord::Relation#becomes!` and `changed_attributes` issues for type
|
1954
|
-
columns.
|
1955
|
-
|
1956
|
-
Fixes #17139.
|
1957
|
-
|
1958
|
-
*Miklos Fazekas*
|
1959
|
-
|
1960
|
-
* Format the time string according to the precision of the time column.
|
1961
|
-
|
1962
|
-
*Ryuta Kamizono*
|
1963
|
-
|
1964
|
-
* Allow a `:precision` option for time type columns.
|
1965
|
-
|
1966
|
-
*Ryuta Kamizono*
|
1967
|
-
|
1968
|
-
* Add `ActiveRecord::Base.suppress` to prevent the receiver from being saved
|
1969
|
-
during the given block.
|
1970
|
-
|
1971
|
-
For example, here's a pattern of creating notifications when new comments
|
1972
|
-
are posted. (The notification may in turn trigger an email, a push
|
1973
|
-
notification, or just appear in the UI somewhere):
|
1974
|
-
|
1975
|
-
class Comment < ActiveRecord::Base
|
1976
|
-
belongs_to :commentable, polymorphic: true
|
1977
|
-
after_create -> { Notification.create! comment: self,
|
1978
|
-
recipients: commentable.recipients }
|
1979
|
-
end
|
1980
|
-
|
1981
|
-
That's what you want the bulk of the time. A new comment creates a new
|
1982
|
-
Notification. There may be edge cases where you don't want that, like
|
1983
|
-
when copying a commentable and its comments, in which case write a
|
1984
|
-
concern with something like this:
|
1985
|
-
|
1986
|
-
module Copyable
|
1987
|
-
def copy_to(destination)
|
1988
|
-
Notification.suppress do
|
1989
|
-
# Copy logic that creates new comments that we do not want triggering
|
1990
|
-
# notifications.
|
1991
|
-
end
|
1992
|
-
end
|
1993
|
-
end
|
1994
|
-
|
1995
|
-
*Michael Ryan*
|
1996
|
-
|
1997
|
-
* `:time` option added for `#touch`.
|
1998
|
-
|
1999
|
-
Fixes #18905.
|
2000
|
-
|
2001
|
-
*Hyonjee Joo*
|
2002
|
-
|
2003
|
-
* Add `foreign_key_exists?` method.
|
2004
|
-
|
2005
|
-
*Tõnis Simo*
|
2006
|
-
|
2007
|
-
* Use SQL COUNT and LIMIT 1 queries for `none?` and `one?` methods
|
2008
|
-
if no block or limit is given, instead of loading the entire
|
2009
|
-
collection into memory. This applies to relations (e.g. `User.all`)
|
2010
|
-
as well as associations (e.g. `account.users`)
|
2011
|
-
|
2012
|
-
# Before:
|
2013
|
-
|
2014
|
-
users.none?
|
2015
|
-
# SELECT "users".* FROM "users"
|
2016
|
-
|
2017
|
-
users.one?
|
2018
|
-
# SELECT "users".* FROM "users"
|
2019
|
-
|
2020
|
-
# After:
|
2021
|
-
|
2022
|
-
users.none?
|
2023
|
-
# SELECT 1 AS one FROM "users" LIMIT 1
|
2024
|
-
|
2025
|
-
users.one?
|
2026
|
-
# SELECT COUNT(*) FROM "users"
|
2027
|
-
|
2028
|
-
*Eugene Gilburg*
|
2029
|
-
|
2030
|
-
* Have `enum` perform type casting consistently with the rest of Active
|
2031
|
-
Record, such as `where`.
|
2032
|
-
|
2033
|
-
*Sean Griffin*
|
2034
|
-
|
2035
|
-
* `scoping` no longer pollutes the current scope of sibling classes when using
|
2036
|
-
STI.
|
2037
|
-
|
2038
|
-
Fixes #18806.
|
2039
|
-
|
2040
|
-
Example:
|
2041
|
-
|
2042
|
-
StiOne.none.scoping do
|
2043
|
-
StiTwo.all
|
2044
|
-
end
|
2045
|
-
|
2046
|
-
|
2047
|
-
*Sean Griffin*
|
2048
|
-
|
2049
|
-
* `remove_reference` with `foreign_key: true` removes the foreign key before
|
2050
|
-
removing the column. This fixes a bug where it was not possible to remove
|
2051
|
-
the column on MySQL.
|
2052
|
-
|
2053
|
-
Fixes #18664.
|
2054
|
-
|
2055
|
-
*Yves Senn*
|
2056
|
-
|
2057
|
-
* `find_in_batches` now accepts an `:finish` parameter that complements the `:start`
|
2058
|
-
parameter to specify where to stop batch processing.
|
2059
|
-
|
2060
|
-
*Vipul A M*
|
2061
|
-
|
2062
|
-
* Fix a rounding problem for PostgreSQL timestamp columns.
|
2063
|
-
|
2064
|
-
If a timestamp column has a precision specified, it needs to
|
2065
|
-
format according to that.
|
2066
|
-
|
2067
|
-
*Ryuta Kamizono*
|
2068
|
-
|
2069
|
-
* Respect the database default charset for `schema_migrations` table.
|
2070
|
-
|
2071
|
-
The charset of `version` column in `schema_migrations` table depends
|
2072
|
-
on the database default charset and collation rather than the encoding
|
2073
|
-
of the connection.
|
2074
|
-
|
2075
|
-
*Ryuta Kamizono*
|
2076
|
-
|
2077
|
-
* Raise `ArgumentError` when passing `nil` or `false` to `Relation#merge`.
|
2078
|
-
|
2079
|
-
These are not valid values to merge in a relation, so it should warn users
|
2080
|
-
early.
|
2081
|
-
|
2082
|
-
*Rafael Mendonça França*
|
2083
|
-
|
2084
|
-
* Use `SCHEMA` instead of `DB_STRUCTURE` for specifying a structure file.
|
2085
|
-
|
2086
|
-
This makes the `db:structure` tasks consistent with `test:load_structure`.
|
2087
|
-
|
2088
|
-
*Dieter Komendera*
|
2089
|
-
|
2090
|
-
* Respect custom primary keys for associations when calling `Relation#where`
|
2091
|
-
|
2092
|
-
Fixes #18813.
|
2093
|
-
|
2094
|
-
*Sean Griffin*
|
2095
|
-
|
2096
|
-
* Fix several edge cases which could result in a counter cache updating
|
2097
|
-
twice or not updating at all for `has_many` and `has_many :through`.
|
2098
|
-
|
2099
|
-
Fixes #10865.
|
2100
|
-
|
2101
|
-
*Sean Griffin*
|
2102
|
-
|
2103
|
-
* Foreign keys added by migrations were given random, generated names. This
|
2104
|
-
meant a different `structure.sql` would be generated every time a developer
|
2105
|
-
ran migrations on their machine.
|
2106
|
-
|
2107
|
-
The generated part of foreign key names is now a hash of the table name and
|
2108
|
-
column name, which is consistent every time you run the migration.
|
2109
|
-
|
2110
|
-
*Chris Sinjakli*
|
2111
|
-
|
2112
|
-
* Fix n+1 query problem when eager loading nil associations (fixes #18312)
|
2113
|
-
|
2114
|
-
*Sammy Larbi*
|
2115
|
-
|
2116
|
-
* Change the default error message from `can't be blank` to `must exist` for
|
2117
|
-
the presence validator of the `:required` option on `belongs_to`/`has_one`
|
2118
|
-
associations.
|
2119
|
-
|
2120
|
-
*Henrik Nygren*
|
2121
|
-
|
2122
|
-
* Fixed `ActiveRecord::Relation#group` method when an argument is an SQL
|
2123
|
-
reserved keyword:
|
2124
|
-
|
2125
|
-
Example:
|
2126
|
-
|
2127
|
-
SplitTest.group(:key).count
|
2128
|
-
Property.group(:value).count
|
2129
|
-
|
2130
|
-
*Bogdan Gusiev*
|
2131
|
-
|
2132
|
-
* Added the `#or` method on `ActiveRecord::Relation`, allowing use of the OR
|
2133
|
-
operator to combine WHERE or HAVING clauses.
|
2134
|
-
|
2135
|
-
Example:
|
2136
|
-
|
2137
|
-
Post.where('id = 1').or(Post.where('id = 2'))
|
2138
|
-
# => SELECT * FROM posts WHERE (id = 1) OR (id = 2)
|
2139
|
-
|
2140
|
-
*Sean Griffin*, *Matthew Draper*, *Gael Muller*, *Olivier El Mekki*
|
2141
|
-
|
2142
|
-
* Don't define autosave association callbacks twice from
|
2143
|
-
`accepts_nested_attributes_for`.
|
2144
|
-
|
2145
|
-
Fixes #18704.
|
2146
|
-
|
2147
|
-
*Sean Griffin*
|
2148
|
-
|
2149
|
-
* Integer types will no longer raise a `RangeError` when assigning an
|
2150
|
-
attribute, but will instead raise when going to the database.
|
2151
|
-
|
2152
|
-
Fixes several vague issues which were never reported directly. See the
|
2153
|
-
commit message from the commit which added this line for some examples.
|
2154
|
-
|
2155
|
-
*Sean Griffin*
|
2156
|
-
|
2157
|
-
* Values which would error while being sent to the database (such as an
|
2158
|
-
ASCII-8BIT string with invalid UTF-8 bytes on SQLite3), no longer error on
|
2159
|
-
assignment. They will still error when sent to the database, but you are
|
2160
|
-
given the ability to re-assign it to a valid value.
|
2161
|
-
|
2162
|
-
Fixes #18580.
|
2163
|
-
|
2164
|
-
*Sean Griffin*
|
2165
|
-
|
2166
|
-
* Don't remove join dependencies in `Relation#exists?`
|
2167
|
-
|
2168
|
-
Fixes #18632.
|
2169
|
-
|
2170
|
-
*Sean Griffin*
|
2171
|
-
|
2172
|
-
* Invalid values assigned to a JSON column are assumed to be `nil`.
|
2173
|
-
|
2174
|
-
Fixes #18629.
|
2175
|
-
|
2176
|
-
*Sean Griffin*
|
2177
|
-
|
2178
|
-
* Add `ActiveRecord::Base#accessed_fields`, which can be used to quickly
|
2179
|
-
discover which fields were read from a model when you are looking to only
|
2180
|
-
select the data you need from the database.
|
2181
|
-
|
2182
|
-
*Sean Griffin*
|
2183
|
-
|
2184
|
-
* Introduce the `:if_exists` option for `drop_table`.
|
2185
|
-
|
2186
|
-
Example:
|
2187
|
-
|
2188
|
-
drop_table(:posts, if_exists: true)
|
2189
|
-
|
2190
|
-
That would execute:
|
2191
|
-
|
2192
|
-
DROP TABLE IF EXISTS posts
|
2193
|
-
|
2194
|
-
If the table doesn't exist, `if_exists: false` (the default) raises an
|
2195
|
-
exception whereas `if_exists: true` does nothing.
|
2196
|
-
|
2197
|
-
*Cody Cutrer*, *Stefan Kanev*, *Ryuta Kamizono*
|
2198
|
-
|
2199
|
-
* Don't run SQL if attribute value is not changed for update_attribute method.
|
2200
|
-
|
2201
|
-
*Prathamesh Sonpatki*
|
2202
|
-
|
2203
|
-
* `time` columns can now get affected by `time_zone_aware_attributes`. If you have
|
2204
|
-
set `config.time_zone` to a value other than `'UTC'`, they will be treated
|
2205
|
-
as in that time zone by default in Rails 5.1. If this is not the desired
|
2206
|
-
behavior, you can set
|
2207
|
-
|
2208
|
-
ActiveRecord::Base.time_zone_aware_types = [:datetime]
|
2209
|
-
|
2210
|
-
A deprecation warning will be emitted if you have a `:time` column, and have
|
2211
|
-
not explicitly opted out.
|
2212
|
-
|
2213
|
-
Fixes #3145.
|
2214
|
-
|
2215
|
-
*Sean Griffin*
|
2216
|
-
|
2217
|
-
* Tests now run after_commit callbacks. You no longer have to declare
|
2218
|
-
`uses_transaction ‘test name’` to test the results of an after_commit.
|
2219
|
-
|
2220
|
-
after_commit callbacks run after committing a transaction whose parent
|
2221
|
-
is not `joinable?`: un-nested transactions, transactions within test cases,
|
2222
|
-
and transactions in `console --sandbox`.
|
2223
|
-
|
2224
|
-
*arthurnn*, *Ravil Bayramgalin*, *Matthew Draper*
|
2225
|
-
|
2226
|
-
* `nil` as a value for a binary column in a query no longer logs as
|
2227
|
-
"<NULL binary data>", and instead logs as just "nil".
|
2228
|
-
|
2229
|
-
*Sean Griffin*
|
2230
|
-
|
2231
|
-
* `attribute_will_change!` will no longer cause non-persistable attributes to
|
2232
|
-
be sent to the database.
|
2233
|
-
|
2234
|
-
Fixes #18407.
|
2235
|
-
|
2236
|
-
*Sean Griffin*
|
2237
|
-
|
2238
|
-
* Remove support for the `protected_attributes` gem.
|
2239
|
-
|
2240
|
-
*Carlos Antonio da Silva*, *Roberto Miranda*
|
2241
|
-
|
2242
|
-
* Fix accessing of fixtures having non-string labels like Fixnum.
|
2243
|
-
|
2244
|
-
*Prathamesh Sonpatki*
|
2245
|
-
|
2246
|
-
* Remove deprecated support to preload instance-dependent associations.
|
2247
|
-
|
2248
|
-
*Yves Senn*
|
2249
|
-
|
2250
|
-
* Remove deprecated support for PostgreSQL ranges with exclusive lower bounds.
|
2251
|
-
|
2252
|
-
*Yves Senn*
|
2253
|
-
|
2254
|
-
* Remove deprecation when modifying a relation with cached Arel.
|
2255
|
-
This raises an `ImmutableRelation` error instead.
|
2256
|
-
|
2257
|
-
*Yves Senn*
|
2258
|
-
|
2259
|
-
* Added `ActiveRecord::SecureToken` in order to encapsulate generation of
|
2260
|
-
unique tokens for attributes in a model using `SecureRandom`.
|
2261
|
-
|
2262
|
-
*Roberto Miranda*
|
2263
|
-
|
2264
|
-
* Change the behavior of boolean columns to be closer to Ruby's semantics.
|
2265
|
-
|
2266
|
-
Before this change we had a small set of "truthy", and all others are "falsy".
|
2267
|
-
|
2268
|
-
Now, we have a small set of "falsy" values and all others are "truthy" matching
|
2269
|
-
Ruby's semantics.
|
2270
|
-
|
2271
|
-
*Rafael Mendonça França*
|
2272
|
-
|
2273
|
-
* Deprecate `ActiveRecord::Base.errors_in_transactional_callbacks=`.
|
2274
|
-
|
2275
|
-
*Rafael Mendonça França*
|
2276
|
-
|
2277
|
-
* Change transaction callbacks to not swallow errors.
|
2278
|
-
|
2279
|
-
Before this change any errors raised inside a transaction callback
|
2280
|
-
were getting rescued and printed in the logs.
|
2281
|
-
|
2282
|
-
Now these errors are not rescued anymore and just bubble up, as the other callbacks.
|
2283
|
-
|
2284
|
-
*Rafael Mendonça França*
|
2285
|
-
|
2286
|
-
* Remove deprecated `sanitize_sql_hash_for_conditions`.
|
2287
|
-
|
2288
|
-
*Rafael Mendonça França*
|
2289
|
-
|
2290
|
-
* Remove deprecated `Reflection#source_macro`.
|
2291
|
-
|
2292
|
-
*Rafael Mendonça França*
|
2293
|
-
|
2294
|
-
* Remove deprecated `symbolized_base_class` and `symbolized_sti_name`.
|
2295
|
-
|
2296
|
-
*Rafael Mendonça França*
|
2297
|
-
|
2298
|
-
* Remove deprecated `ActiveRecord::Base.disable_implicit_join_references=`.
|
2299
|
-
|
2300
|
-
*Rafael Mendonça França*
|
2301
|
-
|
2302
|
-
* Remove deprecated access to connection specification using a string accessor.
|
2303
|
-
|
2304
|
-
Now all strings will be handled as a URL.
|
2305
|
-
|
2306
|
-
*Rafael Mendonça França*
|
2307
|
-
|
2308
|
-
* Change the default `null` value for `timestamps` to `false`.
|
2309
|
-
|
2310
|
-
*Rafael Mendonça França*
|
2311
|
-
|
2312
|
-
* Return an array of pools from `connection_pools`.
|
2313
|
-
|
2314
|
-
*Rafael Mendonça França*
|
2315
|
-
|
2316
|
-
* Return a null column from `column_for_attribute` when no column exists.
|
2317
|
-
|
2318
|
-
*Rafael Mendonça França*
|
2319
|
-
|
2320
|
-
* Remove deprecated `serialized_attributes`.
|
2321
|
-
|
2322
|
-
*Rafael Mendonça França*
|
2323
|
-
|
2324
|
-
* Remove deprecated automatic counter caches on `has_many :through`.
|
2325
|
-
|
2326
|
-
*Rafael Mendonça França*
|
2327
|
-
|
2328
|
-
* Change the way in which callback chains can be halted.
|
2329
|
-
|
2330
|
-
The preferred method to halt a callback chain from now on is to explicitly
|
2331
|
-
`throw(:abort)`.
|
2332
|
-
In the past, returning `false` in an Active Record `before_` callback had the
|
2333
|
-
side effect of halting the callback chain.
|
2334
|
-
This is not recommended anymore and, depending on the value of the
|
2335
|
-
`ActiveSupport.halt_callback_chains_on_return_false` option, will
|
2336
|
-
either not work at all or display a deprecation warning.
|
2337
|
-
|
2338
|
-
*claudiob*
|
2339
|
-
|
2340
|
-
* Clear query cache on rollback.
|
2341
|
-
|
2342
|
-
*Florian Weingarten*
|
2343
|
-
|
2344
|
-
* Fix setting of foreign_key for through associations when building a new record.
|
2345
|
-
|
2346
|
-
Fixes #12698.
|
2347
|
-
|
2348
|
-
*Ivan Antropov*
|
2349
|
-
|
2350
|
-
* Improve dumping of the primary key. If it is not a default primary key,
|
2351
|
-
correctly dump the type and options.
|
2352
|
-
|
2353
|
-
Fixes #14169, #16599.
|
2354
|
-
|
2355
|
-
*Ryuta Kamizono*
|
2356
|
-
|
2357
|
-
* Format the datetime string according to the precision of the datetime field.
|
2358
|
-
|
2359
|
-
Incompatible to rounding behavior between MySQL 5.6 and earlier.
|
2360
|
-
|
2361
|
-
In 5.5, when you insert `2014-08-17 12:30:00.999999` the fractional part
|
2362
|
-
is ignored. In 5.6, it's rounded to `2014-08-17 12:30:01`:
|
2363
|
-
|
2364
|
-
http://bugs.mysql.com/bug.php?id=68760
|
2365
|
-
|
2366
|
-
*Ryuta Kamizono*
|
2367
|
-
|
2368
|
-
* Allow a precision option for MySQL datetimes.
|
2369
|
-
|
2370
|
-
*Ryuta Kamizono*
|
2371
|
-
|
2372
|
-
* Fixed automatic `inverse_of` for models nested in a module.
|
2373
|
-
|
2374
|
-
*Andrew McCloud*
|
2375
|
-
|
2376
|
-
* Change `ActiveRecord::Relation#update` behavior so that it can
|
2377
|
-
be called without passing ids of the records to be updated.
|
2378
|
-
|
2379
|
-
This change allows updating multiple records returned by
|
2380
|
-
`ActiveRecord::Relation` with callbacks and validations.
|
2381
|
-
|
2382
|
-
# Before
|
2383
|
-
# ArgumentError: wrong number of arguments (1 for 2)
|
2384
|
-
Comment.where(group: 'expert').update(body: "Group of Rails Experts")
|
2385
|
-
|
2386
|
-
# After
|
2387
|
-
# Comments with group expert updated with body "Group of Rails Experts"
|
2388
|
-
Comment.where(group: 'expert').update(body: "Group of Rails Experts")
|
2389
|
-
|
2390
|
-
*Prathamesh Sonpatki*
|
2391
|
-
|
2392
|
-
* Fix `reaping_frequency` option when the value is a string.
|
2393
|
-
|
2394
|
-
This usually happens when it is configured using `DATABASE_URL`.
|
2395
|
-
|
2396
|
-
*korbin*
|
2397
|
-
|
2398
|
-
* Fix error message when trying to create an associated record and the foreign
|
2399
|
-
key is missing.
|
2400
|
-
|
2401
|
-
Before this fix the following exception was being raised:
|
2402
|
-
|
2403
|
-
NoMethodError: undefined method `val' for #<Arel::Nodes::BindParam:0x007fc64d19c218>
|
2404
|
-
|
2405
|
-
Now the message is:
|
2406
|
-
|
2407
|
-
ActiveRecord::UnknownAttributeError: unknown attribute 'foreign_key' for Model.
|
2408
|
-
|
2409
|
-
*Rafael Mendonça França*
|
2410
|
-
|
2411
|
-
* Fix change detection problem for PostgreSQL bytea type and
|
2412
|
-
`ArgumentError: string contains null byte` exception with pg-0.18.
|
2413
|
-
|
2414
|
-
Fixes #17680.
|
2415
|
-
|
2416
|
-
*Lars Kanis*
|
2417
|
-
|
2418
|
-
* When a table has a composite primary key, the `primary_key` method for
|
2419
|
-
SQLite3 and PostgreSQL adapters was only returning the first field of the key.
|
2420
|
-
Ensures that it will return nil instead, as Active Record doesn't support
|
2421
|
-
composite primary keys.
|
2422
|
-
|
2423
|
-
Fixes #18070.
|
2424
|
-
|
2425
|
-
*arthurnn*
|
2426
|
-
|
2427
|
-
* `validates_size_of` / `validates_length_of` do not count records
|
2428
|
-
which are `marked_for_destruction?`.
|
2429
|
-
|
2430
|
-
Fixes #7247.
|
2431
|
-
|
2432
|
-
*Yves Senn*
|
2433
|
-
|
2434
|
-
* Ensure `first!` and friends work on loaded associations.
|
2435
|
-
|
2436
|
-
Fixes #18237.
|
2437
|
-
|
2438
|
-
*Sean Griffin*
|
2439
|
-
|
2440
|
-
* `eager_load` preserves readonly flag for associations.
|
2441
|
-
|
2442
|
-
Fixes #15853.
|
2443
|
-
|
2444
|
-
*Takashi Kokubun*
|
2445
|
-
|
2446
|
-
* Provide `:touch` option to `save()` to accommodate saving without updating
|
2447
|
-
timestamps.
|
2448
|
-
|
2449
|
-
Fixes #18202.
|
2450
|
-
|
2451
|
-
*Dan Olson*
|
2452
|
-
|
2453
|
-
* Provide a more helpful error message when an unsupported class is passed to
|
2454
|
-
`serialize`.
|
2455
|
-
|
2456
|
-
Fixes #18224.
|
2457
|
-
|
2458
|
-
*Sean Griffin*
|
2459
|
-
|
2460
|
-
* Add bigint primary key support for MySQL.
|
2461
|
-
|
2462
|
-
Example:
|
2463
|
-
|
2464
|
-
create_table :foos, id: :bigint do |t|
|
2465
|
-
end
|
2466
|
-
|
2467
|
-
*Ryuta Kamizono*
|
2468
|
-
|
2469
|
-
* Support for any type of primary key.
|
2470
|
-
|
2471
|
-
Fixes #14194.
|
2472
|
-
|
2473
|
-
*Ryuta Kamizono*
|
2474
|
-
|
2475
|
-
* Dump the default `nil` for PostgreSQL UUID primary key.
|
2476
|
-
|
2477
|
-
*Ryuta Kamizono*
|
2478
|
-
|
2479
|
-
* Add a `:foreign_key` option to `references` and associated migration
|
2480
|
-
methods. The model and migration generators now use this option, rather than
|
2481
|
-
the `add_foreign_key` form.
|
2482
|
-
|
2483
|
-
*Sean Griffin*
|
2484
|
-
|
2485
|
-
* Don't raise when writing an attribute with an out-of-range datetime passed
|
2486
|
-
by the user.
|
2487
|
-
|
2488
|
-
*Grey Baker*
|
2489
|
-
|
2490
|
-
* Replace deprecated `ActiveRecord::Tasks::DatabaseTasks#load_schema` with
|
2491
|
-
`ActiveRecord::Tasks::DatabaseTasks#load_schema_for`.
|
2492
|
-
|
2493
|
-
*Yves Senn*
|
2494
|
-
|
2495
|
-
* Fix bug with `ActiveRecord::Type::Numeric` that caused negative values to
|
2496
|
-
be marked as having changed when set to the same negative value.
|
2497
|
-
|
2498
|
-
Fixes #18161.
|
2499
|
-
|
2500
|
-
*Daniel Fox*
|
2501
|
-
|
2502
|
-
* Introduce `force: :cascade` option for `create_table`. Using this option
|
2503
|
-
will recreate tables even if they have dependent objects (like foreign keys).
|
2504
|
-
`db/schema.rb` now uses `force: :cascade`. This makes it possible to
|
2505
|
-
reload the schema when foreign keys are in place.
|
2506
|
-
|
2507
|
-
*Matthew Draper*, *Yves Senn*
|
2508
|
-
|
2509
|
-
* `db:schema:load` and `db:structure:load` no longer purge the database
|
2510
|
-
before loading the schema. This is left for the user to do.
|
2511
|
-
`db:test:prepare` will still purge the database.
|
2512
|
-
|
2513
|
-
Fixes #17945.
|
2514
|
-
|
2515
|
-
*Yves Senn*
|
2516
|
-
|
2517
|
-
* Fix undesirable RangeError by `Type::Integer`. Add `Type::UnsignedInteger`.
|
2518
|
-
|
2519
|
-
*Ryuta Kamizono*
|
1340
|
+
* Add support for multiple databases to `rails db:abort_if_pending_migrations`.
|
2520
1341
|
|
2521
|
-
*
|
1342
|
+
*Mark Lee*
|
2522
1343
|
|
2523
|
-
|
1344
|
+
* Fix sqlite3 collation parsing when using decimal columns.
|
2524
1345
|
|
2525
|
-
*
|
1346
|
+
*Martin R. Schuster*
|
2526
1347
|
|
2527
|
-
*
|
2528
|
-
values.
|
1348
|
+
* Fix invalid schema when primary key column has a comment.
|
2529
1349
|
|
2530
|
-
|
1350
|
+
Fixes #29966.
|
2531
1351
|
|
2532
|
-
*
|
2533
|
-
instead.
|
1352
|
+
*Guilherme Goettems Schneider*
|
2534
1353
|
|
2535
|
-
|
1354
|
+
* Fix table comment also being applied to the primary key column.
|
2536
1355
|
|
2537
|
-
*
|
2538
|
-
options.
|
1356
|
+
*Guilherme Goettems Schneider*
|
2539
1357
|
|
2540
|
-
|
1358
|
+
* Allow generated `create_table` migrations to include or skip timestamps.
|
2541
1359
|
|
2542
|
-
*
|
2543
|
-
`ActiveRecord::ConnectionAdapters::ColumnDumper#prepare_column_options` no
|
2544
|
-
longer have a `types` argument. They should access
|
2545
|
-
`connection#native_database_types` directly.
|
1360
|
+
*Michael Duchemin*
|
2546
1361
|
|
2547
|
-
*Yves Senn*
|
2548
1362
|
|
2549
|
-
Please check [
|
1363
|
+
Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/activerecord/CHANGELOG.md) for previous changes.
|