activerecord 4.2.11.1 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activerecord might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/CHANGELOG.md +1282 -1195
- data/MIT-LICENSE +2 -2
- data/README.rdoc +7 -8
- data/examples/performance.rb +2 -3
- data/examples/simple.rb +0 -1
- data/lib/active_record.rb +8 -4
- data/lib/active_record/aggregations.rb +35 -24
- data/lib/active_record/association_relation.rb +3 -3
- data/lib/active_record/associations.rb +317 -209
- data/lib/active_record/associations/alias_tracker.rb +19 -16
- data/lib/active_record/associations/association.rb +11 -9
- data/lib/active_record/associations/association_scope.rb +73 -102
- data/lib/active_record/associations/belongs_to_association.rb +21 -32
- data/lib/active_record/associations/builder/association.rb +28 -34
- data/lib/active_record/associations/builder/belongs_to.rb +43 -18
- data/lib/active_record/associations/builder/collection_association.rb +7 -19
- data/lib/active_record/associations/builder/has_and_belongs_to_many.rb +14 -11
- data/lib/active_record/associations/builder/has_many.rb +4 -4
- data/lib/active_record/associations/builder/has_one.rb +11 -6
- data/lib/active_record/associations/builder/singular_association.rb +3 -10
- data/lib/active_record/associations/collection_association.rb +49 -41
- data/lib/active_record/associations/collection_proxy.rb +67 -27
- data/lib/active_record/associations/foreign_association.rb +1 -1
- data/lib/active_record/associations/has_many_association.rb +20 -71
- data/lib/active_record/associations/has_many_through_association.rb +8 -47
- data/lib/active_record/associations/has_one_association.rb +12 -5
- data/lib/active_record/associations/join_dependency.rb +29 -19
- data/lib/active_record/associations/join_dependency/join_association.rb +16 -10
- data/lib/active_record/associations/preloader.rb +14 -4
- data/lib/active_record/associations/preloader/association.rb +46 -52
- data/lib/active_record/associations/preloader/collection_association.rb +0 -6
- data/lib/active_record/associations/preloader/has_many_through.rb +1 -1
- data/lib/active_record/associations/preloader/has_one.rb +0 -8
- data/lib/active_record/associations/preloader/through_association.rb +27 -14
- data/lib/active_record/associations/singular_association.rb +7 -1
- data/lib/active_record/associations/through_association.rb +11 -3
- data/lib/active_record/attribute.rb +68 -18
- data/lib/active_record/attribute/user_provided_default.rb +28 -0
- data/lib/active_record/attribute_assignment.rb +19 -140
- data/lib/active_record/attribute_decorators.rb +6 -5
- data/lib/active_record/attribute_methods.rb +76 -47
- data/lib/active_record/attribute_methods/before_type_cast.rb +1 -1
- data/lib/active_record/attribute_methods/dirty.rb +46 -86
- data/lib/active_record/attribute_methods/primary_key.rb +2 -2
- data/lib/active_record/attribute_methods/query.rb +2 -2
- data/lib/active_record/attribute_methods/read.rb +31 -59
- data/lib/active_record/attribute_methods/serialization.rb +13 -16
- data/lib/active_record/attribute_methods/time_zone_conversion.rb +61 -14
- data/lib/active_record/attribute_methods/write.rb +13 -37
- data/lib/active_record/attribute_mutation_tracker.rb +70 -0
- data/lib/active_record/attribute_set.rb +30 -3
- data/lib/active_record/attribute_set/builder.rb +6 -4
- data/lib/active_record/attributes.rb +199 -81
- data/lib/active_record/autosave_association.rb +49 -16
- data/lib/active_record/base.rb +32 -23
- data/lib/active_record/callbacks.rb +39 -43
- data/lib/active_record/coders/json.rb +1 -1
- data/lib/active_record/coders/yaml_column.rb +20 -8
- data/lib/active_record/collection_cache_key.rb +40 -0
- data/lib/active_record/connection_adapters/abstract/connection_pool.rb +452 -182
- data/lib/active_record/connection_adapters/abstract/database_limits.rb +3 -3
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +65 -61
- data/lib/active_record/connection_adapters/abstract/query_cache.rb +2 -2
- data/lib/active_record/connection_adapters/abstract/quoting.rb +74 -10
- data/lib/active_record/connection_adapters/abstract/savepoints.rb +3 -3
- data/lib/active_record/connection_adapters/abstract/schema_creation.rb +61 -39
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +236 -185
- data/lib/active_record/connection_adapters/abstract/schema_dumper.rb +72 -17
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +380 -141
- data/lib/active_record/connection_adapters/abstract/transaction.rb +51 -34
- data/lib/active_record/connection_adapters/abstract_adapter.rb +141 -59
- data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +401 -370
- data/lib/active_record/connection_adapters/column.rb +28 -43
- data/lib/active_record/connection_adapters/connection_specification.rb +15 -27
- data/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb +22 -0
- data/lib/active_record/connection_adapters/mysql/column.rb +50 -0
- data/lib/active_record/connection_adapters/mysql/database_statements.rb +125 -0
- data/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb +70 -0
- data/lib/active_record/connection_adapters/mysql/quoting.rb +51 -0
- data/lib/active_record/connection_adapters/mysql/schema_creation.rb +67 -0
- data/lib/active_record/connection_adapters/mysql/schema_definitions.rb +93 -0
- data/lib/active_record/connection_adapters/mysql/schema_dumper.rb +54 -0
- data/lib/active_record/connection_adapters/mysql/type_metadata.rb +32 -0
- data/lib/active_record/connection_adapters/mysql2_adapter.rb +29 -166
- data/lib/active_record/connection_adapters/postgresql/column.rb +5 -10
- data/lib/active_record/connection_adapters/postgresql/database_statements.rb +10 -72
- data/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb +42 -0
- data/lib/active_record/connection_adapters/postgresql/oid.rb +1 -6
- data/lib/active_record/connection_adapters/postgresql/oid/array.rb +27 -57
- data/lib/active_record/connection_adapters/postgresql/oid/bit.rb +2 -2
- data/lib/active_record/connection_adapters/postgresql/oid/bytea.rb +1 -1
- data/lib/active_record/connection_adapters/postgresql/oid/cidr.rb +3 -1
- data/lib/active_record/connection_adapters/postgresql/oid/date_time.rb +7 -22
- data/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +3 -3
- data/lib/active_record/connection_adapters/postgresql/oid/json.rb +1 -26
- data/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb +2 -2
- data/lib/active_record/connection_adapters/postgresql/oid/money.rb +0 -4
- data/lib/active_record/connection_adapters/postgresql/oid/point.rb +4 -4
- data/lib/active_record/connection_adapters/postgresql/oid/rails_5_1_point.rb +50 -0
- data/lib/active_record/connection_adapters/postgresql/oid/range.rb +31 -17
- data/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb +0 -4
- data/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +2 -2
- data/lib/active_record/connection_adapters/postgresql/oid/vector.rb +1 -1
- data/lib/active_record/connection_adapters/postgresql/oid/xml.rb +1 -1
- data/lib/active_record/connection_adapters/postgresql/quoting.rb +26 -18
- data/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +29 -10
- data/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +107 -79
- data/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +47 -0
- data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +234 -148
- data/lib/active_record/connection_adapters/postgresql/type_metadata.rb +35 -0
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +248 -160
- data/lib/active_record/connection_adapters/schema_cache.rb +36 -23
- data/lib/active_record/connection_adapters/sql_type_metadata.rb +32 -0
- data/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb +19 -0
- data/lib/active_record/connection_adapters/sqlite3/quoting.rb +48 -0
- data/lib/active_record/connection_adapters/sqlite3/schema_creation.rb +22 -0
- data/lib/active_record/connection_adapters/sqlite3_adapter.rb +149 -192
- data/lib/active_record/connection_adapters/statement_pool.rb +31 -12
- data/lib/active_record/connection_handling.rb +37 -14
- data/lib/active_record/core.rb +89 -107
- data/lib/active_record/counter_cache.rb +13 -24
- data/lib/active_record/dynamic_matchers.rb +1 -20
- data/lib/active_record/enum.rb +113 -76
- data/lib/active_record/errors.rb +87 -48
- data/lib/active_record/explain_registry.rb +1 -1
- data/lib/active_record/explain_subscriber.rb +1 -1
- data/lib/active_record/fixture_set/file.rb +26 -5
- data/lib/active_record/fixtures.rb +76 -40
- data/lib/active_record/gem_version.rb +4 -4
- data/lib/active_record/inheritance.rb +32 -40
- data/lib/active_record/integration.rb +4 -4
- data/lib/active_record/internal_metadata.rb +56 -0
- data/lib/active_record/legacy_yaml_adapter.rb +18 -2
- data/lib/active_record/locale/en.yml +3 -2
- data/lib/active_record/locking/optimistic.rb +15 -15
- data/lib/active_record/locking/pessimistic.rb +1 -1
- data/lib/active_record/log_subscriber.rb +43 -21
- data/lib/active_record/migration.rb +363 -133
- data/lib/active_record/migration/command_recorder.rb +59 -18
- data/lib/active_record/migration/compatibility.rb +126 -0
- data/lib/active_record/model_schema.rb +129 -41
- data/lib/active_record/nested_attributes.rb +58 -29
- data/lib/active_record/null_relation.rb +16 -8
- data/lib/active_record/persistence.rb +121 -80
- data/lib/active_record/query_cache.rb +15 -18
- data/lib/active_record/querying.rb +10 -9
- data/lib/active_record/railtie.rb +23 -16
- data/lib/active_record/railties/controller_runtime.rb +1 -1
- data/lib/active_record/railties/databases.rake +69 -46
- data/lib/active_record/readonly_attributes.rb +1 -1
- data/lib/active_record/reflection.rb +282 -115
- data/lib/active_record/relation.rb +176 -116
- data/lib/active_record/relation/batches.rb +139 -34
- data/lib/active_record/relation/batches/batch_enumerator.rb +67 -0
- data/lib/active_record/relation/calculations.rb +79 -108
- data/lib/active_record/relation/delegation.rb +7 -20
- data/lib/active_record/relation/finder_methods.rb +163 -81
- data/lib/active_record/relation/from_clause.rb +32 -0
- data/lib/active_record/relation/merger.rb +16 -42
- data/lib/active_record/relation/predicate_builder.rb +120 -107
- data/lib/active_record/relation/predicate_builder/array_handler.rb +11 -16
- data/lib/active_record/relation/predicate_builder/association_query_handler.rb +88 -0
- data/lib/active_record/relation/predicate_builder/base_handler.rb +17 -0
- data/lib/active_record/relation/predicate_builder/basic_object_handler.rb +17 -0
- data/lib/active_record/relation/predicate_builder/class_handler.rb +27 -0
- data/lib/active_record/relation/predicate_builder/polymorphic_array_handler.rb +57 -0
- data/lib/active_record/relation/predicate_builder/range_handler.rb +33 -0
- data/lib/active_record/relation/predicate_builder/relation_handler.rb +1 -1
- data/lib/active_record/relation/query_attribute.rb +19 -0
- data/lib/active_record/relation/query_methods.rb +308 -244
- data/lib/active_record/relation/record_fetch_warning.rb +49 -0
- data/lib/active_record/relation/spawn_methods.rb +4 -7
- data/lib/active_record/relation/where_clause.rb +174 -0
- data/lib/active_record/relation/where_clause_factory.rb +38 -0
- data/lib/active_record/result.rb +4 -3
- data/lib/active_record/runtime_registry.rb +1 -1
- data/lib/active_record/sanitization.rb +95 -66
- data/lib/active_record/schema.rb +26 -22
- data/lib/active_record/schema_dumper.rb +62 -38
- data/lib/active_record/schema_migration.rb +11 -14
- data/lib/active_record/scoping.rb +32 -15
- data/lib/active_record/scoping/default.rb +23 -9
- data/lib/active_record/scoping/named.rb +49 -28
- data/lib/active_record/secure_token.rb +38 -0
- data/lib/active_record/serialization.rb +2 -4
- data/lib/active_record/statement_cache.rb +16 -14
- data/lib/active_record/store.rb +8 -3
- data/lib/active_record/suppressor.rb +58 -0
- data/lib/active_record/table_metadata.rb +68 -0
- data/lib/active_record/tasks/database_tasks.rb +57 -43
- data/lib/active_record/tasks/mysql_database_tasks.rb +6 -14
- data/lib/active_record/tasks/postgresql_database_tasks.rb +11 -2
- data/lib/active_record/tasks/sqlite_database_tasks.rb +5 -1
- data/lib/active_record/timestamp.rb +20 -9
- data/lib/active_record/touch_later.rb +58 -0
- data/lib/active_record/transactions.rb +138 -56
- data/lib/active_record/type.rb +66 -17
- data/lib/active_record/type/adapter_specific_registry.rb +130 -0
- data/lib/active_record/type/date.rb +2 -45
- data/lib/active_record/type/date_time.rb +2 -49
- data/lib/active_record/type/internal/abstract_json.rb +29 -0
- data/lib/active_record/type/internal/timezone.rb +15 -0
- data/lib/active_record/type/serialized.rb +15 -14
- data/lib/active_record/type/time.rb +10 -16
- data/lib/active_record/type/type_map.rb +4 -4
- data/lib/active_record/type_caster.rb +7 -0
- data/lib/active_record/type_caster/connection.rb +29 -0
- data/lib/active_record/type_caster/map.rb +19 -0
- data/lib/active_record/validations.rb +33 -32
- data/lib/active_record/validations/absence.rb +23 -0
- data/lib/active_record/validations/associated.rb +10 -3
- data/lib/active_record/validations/length.rb +24 -0
- data/lib/active_record/validations/presence.rb +11 -12
- data/lib/active_record/validations/uniqueness.rb +30 -29
- data/lib/rails/generators/active_record/migration.rb +7 -0
- data/lib/rails/generators/active_record/migration/migration_generator.rb +7 -4
- data/lib/rails/generators/active_record/migration/templates/create_table_migration.rb +8 -3
- data/lib/rails/generators/active_record/migration/templates/migration.rb +8 -1
- data/lib/rails/generators/active_record/model/model_generator.rb +32 -15
- data/lib/rails/generators/active_record/model/templates/application_record.rb +5 -0
- data/lib/rails/generators/active_record/model/templates/model.rb +3 -0
- metadata +59 -34
- data/lib/active_record/connection_adapters/mysql_adapter.rb +0 -498
- data/lib/active_record/connection_adapters/postgresql/array_parser.rb +0 -93
- data/lib/active_record/connection_adapters/postgresql/oid/date.rb +0 -11
- data/lib/active_record/connection_adapters/postgresql/oid/float.rb +0 -21
- data/lib/active_record/connection_adapters/postgresql/oid/infinity.rb +0 -13
- data/lib/active_record/connection_adapters/postgresql/oid/integer.rb +0 -11
- data/lib/active_record/connection_adapters/postgresql/oid/time.rb +0 -11
- data/lib/active_record/serializers/xml_serializer.rb +0 -193
- data/lib/active_record/type/big_integer.rb +0 -13
- data/lib/active_record/type/binary.rb +0 -50
- data/lib/active_record/type/boolean.rb +0 -31
- data/lib/active_record/type/decimal.rb +0 -64
- data/lib/active_record/type/decimal_without_scale.rb +0 -11
- data/lib/active_record/type/decorator.rb +0 -14
- data/lib/active_record/type/float.rb +0 -19
- data/lib/active_record/type/integer.rb +0 -59
- data/lib/active_record/type/mutable.rb +0 -16
- data/lib/active_record/type/numeric.rb +0 -36
- data/lib/active_record/type/string.rb +0 -40
- data/lib/active_record/type/text.rb +0 -11
- data/lib/active_record/type/time_value.rb +0 -38
- data/lib/active_record/type/unsigned_integer.rb +0 -15
- data/lib/active_record/type/value.rb +0 -110
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 175e4ed30958c211689abda4a5664d2314821c19
|
4
|
+
data.tar.gz: b22c909734c877decd541b4585e6107f4a853824
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb75298c265d53bb950437f9eeabe32ce75a5226aa1eb180d014cb3420ee7895a97ac74f2a2d7643b54f6fce7106a2c33d169fe288c6e9950f3d726dd7488b17
|
7
|
+
data.tar.gz: 7999af5a3505e7e95ea5b1226d0ff2bf5af784e59b3355376dbb0d4fe79a1a79346ebcfbb9d2a524797e376843a2213b2fc60a69d61aa519d60ba86f9cde37c9
|
data/CHANGELOG.md
CHANGED
@@ -1,2033 +1,2120 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 5.0.0 (June 30, 2016) ##
|
2
2
|
|
3
|
-
*
|
4
|
-
|
5
|
-
|
6
|
-
## Rails 4.2.11 (November 27, 2018) ##
|
7
|
-
|
8
|
-
* No changes.
|
9
|
-
|
10
|
-
|
11
|
-
## Rails 4.2.10 (September 27, 2017) ##
|
12
|
-
|
13
|
-
* `Relation#joins` is no longer affected by the target model's
|
14
|
-
`current_scope`, with the exception of `unscoped`.
|
15
|
-
|
16
|
-
Fixes #29338.
|
3
|
+
* Ensure hashes can be assigned to attributes created using `composed_of`.
|
4
|
+
Fixes #25210.
|
17
5
|
|
18
6
|
*Sean Griffin*
|
19
7
|
|
20
|
-
|
21
|
-
|
22
|
-
* Fix regression caused by `collection_singular_ids=` ignoring different primary key on relationship.
|
23
|
-
|
24
|
-
*Nick Pezza*
|
8
|
+
* Fix logging edge case where if an attribute was of the binary type and
|
9
|
+
was provided as a Hash.
|
25
10
|
|
26
|
-
*
|
11
|
+
*Jon Moss*
|
27
12
|
|
28
|
-
|
29
|
-
|
30
|
-
* Fix `rake db:migrate:status` with subdirectories.
|
13
|
+
* Handle JSON deserialization correctly if the column default from database
|
14
|
+
adapter returns `''` instead of `nil`.
|
31
15
|
|
32
|
-
*
|
16
|
+
*Johannes Opper*
|
33
17
|
|
34
|
-
*
|
18
|
+
* PostgreSQL: Support Expression Indexes and Operator Classes.
|
35
19
|
|
36
|
-
|
20
|
+
Example:
|
37
21
|
|
38
|
-
|
22
|
+
create_table :users do |t|
|
23
|
+
t.string :name
|
24
|
+
t.index 'lower(name) varchar_pattern_ops'
|
25
|
+
end
|
39
26
|
|
40
|
-
Fixes #
|
27
|
+
Fixes #19090, #21765, #21819, #24359.
|
41
28
|
|
42
29
|
*Ryuta Kamizono*
|
43
30
|
|
44
|
-
*
|
45
|
-
so queries are not run against the previous table name.
|
46
|
-
|
47
|
-
*namusyaka*
|
31
|
+
* MySQL: Prepared statements support.
|
48
32
|
|
33
|
+
To enable, set `prepared_statements: true` in config/database.yml.
|
34
|
+
Requires mysql2 0.4.4+.
|
49
35
|
|
50
|
-
|
36
|
+
*Ryuta Kamizono*
|
51
37
|
|
52
|
-
*
|
53
|
-
|
38
|
+
* Schema dumper: Indexes are now included in the `create_table` block
|
39
|
+
instead of listed afterward as separate `add_index` lines.
|
54
40
|
|
55
|
-
|
41
|
+
This tidies up schema.rb and makes it easy to read as a list of tables.
|
56
42
|
|
57
|
-
|
43
|
+
Bonus: Allows databases that support it (MySQL) to perform as single
|
44
|
+
`CREATE TABLE` query, no additional query per index.
|
58
45
|
|
59
|
-
*
|
46
|
+
*Ryuta Kamizono*
|
60
47
|
|
61
|
-
* Fix
|
48
|
+
* SQLite: Fix uniqueness validation when values exceed the column limit.
|
62
49
|
|
63
|
-
|
50
|
+
SQLite doesn't impose length restrictions on strings, BLOBs, or numeric
|
51
|
+
values. It treats them as helpful metadata. When we truncate strings
|
52
|
+
before checking uniqueness, we'd miss values that exceed the column limit.
|
64
53
|
|
65
|
-
|
54
|
+
Other databases enforce length limits. A large value will pass uniqueness
|
55
|
+
validation since the column limit guarantees no value that long exists.
|
56
|
+
When we insert the row, it'll raise `ActiveRecord::ValueTooLong` as we
|
57
|
+
expect.
|
66
58
|
|
67
|
-
|
68
|
-
|
69
|
-
|
59
|
+
This fixes edge-case incorrect validation failures for values that exceed
|
60
|
+
the column limit but are identical to an existing value *when truncated*.
|
61
|
+
Now these will pass validation and raise an exception.
|
70
62
|
|
71
|
-
*
|
63
|
+
*Ryuta Kamizono*
|
72
64
|
|
73
|
-
*
|
74
|
-
|
65
|
+
* Raise `ActiveRecord::ValueTooLong` when column limits are exceeded.
|
66
|
+
Supported by MySQL and PostgreSQL adapters.
|
75
67
|
|
76
|
-
|
68
|
+
*Ryuta Kamizono*
|
77
69
|
|
78
|
-
|
70
|
+
* Migrations: `#foreign_key` respects `table_name_prefix` and `_suffix`.
|
79
71
|
|
72
|
+
*Ryuta Kamizono*
|
80
73
|
|
81
|
-
|
74
|
+
* SQLite: Force NOT NULL primary keys.
|
82
75
|
|
83
|
-
|
84
|
-
|
85
|
-
|
76
|
+
From SQLite docs: https://www.sqlite.org/lang_createtable.html
|
77
|
+
According to the SQL standard, PRIMARY KEY should always imply NOT
|
78
|
+
NULL. Unfortunately, due to a bug in some early versions, this is not
|
79
|
+
the case in SQLite. Unless the column is an INTEGER PRIMARY KEY or the
|
80
|
+
table is a WITHOUT ROWID table or the column is declared NOT NULL,
|
81
|
+
SQLite allows NULL values in a PRIMARY KEY column. SQLite could be
|
82
|
+
fixed to conform to the standard, but doing so might break legacy
|
83
|
+
applications. Hence, it has been decided to merely document the fact
|
84
|
+
that SQLite allowing NULLs in most PRIMARY KEY columns.
|
86
85
|
|
87
|
-
|
86
|
+
Now we override column options to explicitly set NOT NULL rather than rely
|
87
|
+
on implicit NOT NULL like MySQL and PostgreSQL adapters.
|
88
88
|
|
89
|
-
*
|
90
|
-
Fixes #25210.
|
89
|
+
*Ryuta Kamizono*
|
91
90
|
|
92
|
-
|
91
|
+
* Added notice when a database is successfully created or dropped.
|
93
92
|
|
94
|
-
|
95
|
-
interpreted as `Computer.joins(:monitor).group('computers.status').count`
|
96
|
-
so that when `Computer` and `Monitor` have both `status` columns we don't
|
97
|
-
have conflicts in projection.
|
98
|
-
|
99
|
-
*Rafael Sales*
|
93
|
+
Example:
|
100
94
|
|
101
|
-
|
102
|
-
|
103
|
-
|
95
|
+
$ bin/rails db:create
|
96
|
+
Created database 'blog_development'
|
97
|
+
Created database 'blog_test'
|
104
98
|
|
105
|
-
|
99
|
+
$ bin/rails db:drop
|
100
|
+
Dropped database 'blog_development'
|
101
|
+
Dropped database 'blog_test'
|
106
102
|
|
107
|
-
|
103
|
+
Changed older notices
|
104
|
+
`blog_development already exists` to `Database 'blog_development' already exists`.
|
105
|
+
and
|
106
|
+
`Couldn't drop blog_development` to `Couldn't drop database 'blog_development'`.
|
108
107
|
|
109
|
-
*
|
108
|
+
*bogdanvlviv*
|
110
109
|
|
111
|
-
|
110
|
+
* Database comments. Annotate database objects (tables, columns, indexes)
|
111
|
+
with comments stored in database metadata. PostgreSQL & MySQL support.
|
112
112
|
|
113
|
-
|
113
|
+
create_table :pages, force: :cascade, comment: 'CMS content pages' do |t|
|
114
|
+
t.string :path, comment: 'Path fragment of page URL used for routing'
|
115
|
+
t.string :locale, comment: 'RFC 3066 locale code of website language section'
|
116
|
+
t.index [:path, :locale], comment: 'Look up pages by URI'
|
117
|
+
end
|
114
118
|
|
119
|
+
*Andrey Novikov*
|
115
120
|
|
116
|
-
|
121
|
+
* Add `quoted_time` for truncating the date part of a TIME column value.
|
122
|
+
This fixes queries on TIME column on MariaDB, as it doesn't ignore the
|
123
|
+
date part of the string when it coerces to time.
|
117
124
|
|
118
|
-
*
|
119
|
-
the same table definition would only create one foreign key.
|
125
|
+
*Ryuta Kamizono*
|
120
126
|
|
121
|
-
|
127
|
+
* Properly accept all valid JSON primitives in the JSON data type.
|
122
128
|
|
123
|
-
|
124
|
-
clone no longer show as changed attributes in the original object.
|
129
|
+
Fixes #24234
|
125
130
|
|
126
|
-
*
|
131
|
+
*Sean Griffin*
|
127
132
|
|
128
|
-
*
|
133
|
+
* MariaDB 5.3+ supports microsecond datetime precision.
|
129
134
|
|
130
|
-
|
135
|
+
*Jeremy Daer*
|
131
136
|
|
132
|
-
|
137
|
+
* Delegate `none?` and `one?`. Now they can be invoked as model class methods.
|
133
138
|
|
134
|
-
|
139
|
+
Example:
|
135
140
|
|
136
|
-
|
141
|
+
# When no record is found on the table
|
142
|
+
Topic.none? # => true
|
137
143
|
|
138
|
-
|
144
|
+
# When only one record is found on the table
|
145
|
+
Topic.one? # => true
|
139
146
|
|
140
|
-
*
|
141
|
-
These methods determine what relations can be used to back Active Record
|
142
|
-
models (usually tables and views).
|
147
|
+
*Kenta Shirai*
|
143
148
|
|
144
|
-
|
149
|
+
* The form builder now properly displays values when passing a proc form
|
150
|
+
default to the attributes API.
|
145
151
|
|
152
|
+
Fixes #24249.
|
146
153
|
|
147
|
-
|
148
|
-
|
149
|
-
* No changes.
|
154
|
+
*Sean Griffin*
|
150
155
|
|
156
|
+
* The schema cache is now cleared after the `db:migrate` task is run.
|
151
157
|
|
152
|
-
|
158
|
+
Closes #24273.
|
153
159
|
|
154
|
-
*
|
160
|
+
*Chris Arcand*
|
155
161
|
|
162
|
+
* MySQL: strict mode respects other SQL modes rather than overwriting them.
|
163
|
+
Setting `strict: true` adds `STRICT_ALL_TABLES` to `sql_mode`. Setting
|
164
|
+
`strict: false` removes `STRICT_TRANS_TABLES`, `STRICT_ALL_TABLES`, and
|
165
|
+
`TRADITIONAL` from `sql_mode`.
|
156
166
|
|
157
|
-
|
167
|
+
*Ryuta Kamizono*
|
158
168
|
|
159
|
-
*
|
169
|
+
* Execute default_scope defined by abstract class in the context of subclass.
|
160
170
|
|
161
|
-
|
171
|
+
Fixes #23413.
|
172
|
+
Fixes #10658.
|
162
173
|
|
163
|
-
*
|
174
|
+
*Mehmet Emin İNAÇ*
|
164
175
|
|
165
|
-
|
176
|
+
* Fix an issue when preloading associations with extensions.
|
177
|
+
Previously every association with extension methods was transformed into an
|
178
|
+
instance dependent scope. This is no longer the case.
|
166
179
|
|
167
|
-
|
180
|
+
Fixes #23934.
|
168
181
|
|
169
|
-
*
|
170
|
-
standard_conforming_strings setting. Errors were previously disabled because
|
171
|
-
the setting wasn't writable in Postgres 8.1 and didn't exist in earlier
|
172
|
-
versions. Now Rails only supports Postgres 8.2+ we're fine to assume the
|
173
|
-
setting exists. Disabling errors caused problems when using a connection
|
174
|
-
pooling tool like PgBouncer because it's not guaranteed to have the same
|
175
|
-
connection between calls to `execute` and it could leave the connection
|
176
|
-
with errors disabled.
|
182
|
+
*Yves Senn*
|
177
183
|
|
178
|
-
|
184
|
+
* Deprecate `{insert|update|delete}_sql` in `DatabaseStatements`.
|
185
|
+
Use the `{insert|update|delete}` public methods instead.
|
179
186
|
|
180
|
-
*
|
187
|
+
*Ryuta Kamizono*
|
181
188
|
|
182
|
-
*
|
183
|
-
|
189
|
+
* Added a configuration option to have active record raise an ArgumentError
|
190
|
+
if the order or limit is ignored in a batch query, rather than logging a
|
191
|
+
warning message.
|
184
192
|
|
185
|
-
|
193
|
+
*Scott Ringwelski*
|
186
194
|
|
187
|
-
|
195
|
+
* Honour the order of the joining model in a `has_many :through` association when eager loading.
|
188
196
|
|
189
|
-
|
197
|
+
Example:
|
190
198
|
|
191
|
-
|
192
|
-
Project.includes(:salaried_developers).first.salaried_developers.size # => 1
|
199
|
+
The below will now follow the order of `by_lines` when eager loading `authors`.
|
193
200
|
|
194
|
-
|
201
|
+
class Article < ActiveRecord::Base
|
202
|
+
has_many :by_lines, -> { order(:position) }
|
203
|
+
has_many :authors, through: :by_lines
|
204
|
+
end
|
195
205
|
|
196
|
-
|
197
|
-
Project.includes(:salaried_developers).first.salaried_developers.size # => 3
|
206
|
+
Fixes #17864.
|
198
207
|
|
199
|
-
*
|
208
|
+
*Yasyf Mohamedali*, *Joel Turkel*
|
200
209
|
|
201
|
-
*
|
210
|
+
* Ensure that the Suppressor runs before validations.
|
202
211
|
|
203
|
-
|
212
|
+
This moves the suppressor up to be run before validations rather than after
|
213
|
+
validations. There's no reason to validate a record you aren't planning on saving.
|
204
214
|
|
205
|
-
*
|
215
|
+
*Eileen M. Uchitelle*
|
206
216
|
|
207
|
-
*
|
208
|
-
`ActiveRecord::Tasks::DatabaseTasks.migrations_paths` instead of
|
209
|
-
`Migrator.migrations_paths`.
|
217
|
+
* Save many-to-many objects based on association primary key.
|
210
218
|
|
211
|
-
|
219
|
+
Fixes #20995.
|
212
220
|
|
213
|
-
*
|
221
|
+
*himesh-r*
|
214
222
|
|
215
|
-
|
223
|
+
* Ensure that mutations of the array returned from `ActiveRecord::Relation#to_a`
|
224
|
+
do not affect the original relation, by returning a duplicate array each time.
|
216
225
|
|
217
|
-
|
226
|
+
This brings the behavior in line with `CollectionProxy#to_a`, which was
|
227
|
+
already more careful.
|
218
228
|
|
219
|
-
*
|
220
|
-
drying up Kernel.system() calls within this namespace and to avoid
|
221
|
-
shell expansion by using a paramter list instead of string as arguments
|
222
|
-
for Kernel.system(). Thanks to Nate Berkopec for supply patch to get
|
223
|
-
test units passing.
|
229
|
+
*Matthew Draper*
|
224
230
|
|
225
|
-
|
231
|
+
* Fixed `where` for polymorphic associations when passed an array containing different types.
|
226
232
|
|
227
|
-
|
233
|
+
Fixes #17011.
|
228
234
|
|
229
|
-
|
235
|
+
Example:
|
230
236
|
|
231
|
-
|
237
|
+
PriceEstimate.where(estimate_of: [Treasure.find(1), Car.find(2)])
|
238
|
+
# => SELECT "price_estimates".* FROM "price_estimates"
|
239
|
+
WHERE (("price_estimates"."estimate_of_type" = 'Treasure' AND "price_estimates"."estimate_of_id" = 1)
|
240
|
+
OR ("price_estimates"."estimate_of_type" = 'Car' AND "price_estimates"."estimate_of_id" = 2))
|
232
241
|
|
233
|
-
*
|
234
|
-
to Rails 4.2
|
242
|
+
*Philippe Huibonhoa*
|
235
243
|
|
236
|
-
|
244
|
+
* Fix a bug where using `t.foreign_key` twice with the same `to_table` within
|
245
|
+
the same table definition would only create one foreign key.
|
237
246
|
|
238
|
-
*
|
247
|
+
*George Millo*
|
239
248
|
|
240
|
-
|
249
|
+
* Fix a regression on has many association, where calling a child from parent in child's callback
|
250
|
+
results in same child records getting added repeatedly to target.
|
241
251
|
|
242
|
-
|
252
|
+
Fixes #13387.
|
243
253
|
|
244
|
-
|
254
|
+
*Bogdan Gusiev*, *Jon Hinson*
|
245
255
|
|
246
|
-
|
256
|
+
* Rework `ActiveRecord::Relation#last`.
|
247
257
|
|
248
|
-
|
258
|
+
1. Never perform additional SQL on loaded relation
|
259
|
+
2. Use SQL reverse order instead of loading relation if relation doesn't have limit
|
260
|
+
3. Deprecated relation loading when SQL order can not be automatically reversed
|
249
261
|
|
250
|
-
|
262
|
+
Topic.order("title").load.last(3)
|
263
|
+
# before: SELECT ...
|
264
|
+
# after: No SQL
|
251
265
|
|
252
|
-
|
253
|
-
|
266
|
+
Topic.order("title").last
|
267
|
+
# before: SELECT * FROM `topics`
|
268
|
+
# after: SELECT * FROM `topics` ORDER BY `topics`.`title` DESC LIMIT 1
|
254
269
|
|
255
|
-
|
270
|
+
Topic.order("coalesce(author, title)").last
|
271
|
+
# before: SELECT * FROM `topics`
|
272
|
+
# after: Deprecation Warning for irreversible order
|
256
273
|
|
257
|
-
*
|
274
|
+
*Bogdan Gusiev*
|
258
275
|
|
276
|
+
* Allow `joins` to be unscoped.
|
259
277
|
|
260
|
-
|
278
|
+
Fixes #13775.
|
261
279
|
|
262
|
-
*
|
280
|
+
*Takashi Kokubun*
|
263
281
|
|
264
|
-
|
265
|
-
cache.
|
282
|
+
* Add ActiveRecord `#second_to_last` and `#third_to_last` methods.
|
266
283
|
|
267
|
-
|
284
|
+
*Brian Christian*
|
268
285
|
|
269
|
-
|
286
|
+
* Added `numeric` helper into migrations.
|
270
287
|
|
271
|
-
|
272
|
-
the limit: 8 was not coming through. This caused it to become Int[] data type
|
273
|
-
after doing a rebuild off of schema.rb.
|
288
|
+
Example:
|
274
289
|
|
275
|
-
|
290
|
+
create_table(:numeric_types) do |t|
|
291
|
+
t.numeric :numeric_type, precision: 10, scale: 2
|
292
|
+
end
|
276
293
|
|
277
|
-
*
|
294
|
+
*Mehmet Emin İNAÇ*
|
278
295
|
|
279
|
-
|
280
|
-
|
296
|
+
* Bumped the minimum supported version of PostgreSQL to >= 9.1.
|
297
|
+
Both PG 9.0 and 8.4 are past their end of life date:
|
298
|
+
http://www.postgresql.org/support/versioning/
|
281
299
|
|
282
|
-
|
283
|
-
author.name = nil
|
284
|
-
author.save # => false
|
285
|
-
author.new_record? # => true
|
300
|
+
*Remo Mueller*
|
286
301
|
|
287
|
-
|
302
|
+
* `ActiveRecord::Relation#reverse_order` throws `ActiveRecord::IrreversibleOrderError`
|
303
|
+
when the order can not be reversed using current trivial algorithm.
|
304
|
+
Also raises the same error when `#reverse_order` is called on
|
305
|
+
relation without any order and table has no primary key:
|
288
306
|
|
289
|
-
|
307
|
+
Topic.order("concat(author_name, title)").reverse_order
|
308
|
+
# Before: SELECT `topics`.* FROM `topics` ORDER BY concat(author_name DESC, title) DESC
|
309
|
+
# After: raises ActiveRecord::IrreversibleOrderError
|
310
|
+
Edge.all.reverse_order
|
311
|
+
# Before: SELECT `edges`.* FROM `edges` ORDER BY `edges`.`` DESC
|
312
|
+
# After: raises ActiveRecord::IrreversibleOrderError
|
290
313
|
|
291
|
-
*
|
292
|
-
when validating associations.
|
314
|
+
*Bogdan Gusiev*
|
293
315
|
|
294
|
-
|
316
|
+
* Improve schema_migrations insertion performance by inserting all versions
|
317
|
+
in one INSERT SQL.
|
295
318
|
|
296
|
-
*
|
319
|
+
*Akira Matsuda*, *Naoto Koshikawa*
|
297
320
|
|
298
|
-
*
|
299
|
-
|
321
|
+
* Using `references` or `belongs_to` in migrations will always add index
|
322
|
+
for the referenced column by default, without adding `index: true` option
|
323
|
+
to generated migration file. Users can opt out of this by passing
|
324
|
+
`index: false`.
|
300
325
|
|
301
|
-
Fixes #
|
302
|
-
Fixes #20727.
|
326
|
+
Fixes #18146.
|
303
327
|
|
304
|
-
*
|
328
|
+
*Matthew Draper*, *Prathamesh Sonpatki*
|
305
329
|
|
306
|
-
* `
|
307
|
-
|
330
|
+
* Run `type` attributes through attributes API type-casting before
|
331
|
+
instantiating the corresponding subclass. This makes it possible to define
|
332
|
+
custom STI mappings.
|
308
333
|
|
309
|
-
Fixes #
|
334
|
+
Fixes #21986.
|
310
335
|
|
311
336
|
*Yves Senn*
|
312
337
|
|
313
|
-
*
|
314
|
-
|
315
|
-
|
316
|
-
Fixes #20545.
|
317
|
-
|
318
|
-
*Diego Carrion*
|
319
|
-
|
320
|
-
* Prevent error when using `force_reload: true` on an unassigned polymorphic
|
321
|
-
belongs_to association.
|
322
|
-
|
323
|
-
Fixes #20426.
|
324
|
-
|
325
|
-
*James Dabbs*
|
326
|
-
|
338
|
+
* Don't try to quote functions or expressions passed to `:default` option if
|
339
|
+
they are passed as procs.
|
327
340
|
|
328
|
-
|
341
|
+
This will generate proper query with the passed function or expression for
|
342
|
+
the default option, instead of trying to quote it in incorrect fashion.
|
329
343
|
|
330
|
-
|
331
|
-
|
332
|
-
*Vladimir Kochnev*
|
333
|
-
|
334
|
-
* Fix n+1 query problem when eager loading nil associations (fixes #18312)
|
335
|
-
|
336
|
-
*Sammy Larbi*
|
344
|
+
Example:
|
337
345
|
|
338
|
-
|
339
|
-
|
346
|
+
create_table :posts do |t|
|
347
|
+
t.datetime :published_at, default: -> { 'NOW()' }
|
348
|
+
end
|
340
349
|
|
341
|
-
|
350
|
+
*Ryuta Kamizono*
|
342
351
|
|
343
|
-
|
352
|
+
* Fix regression when loading fixture files with symbol keys.
|
344
353
|
|
345
|
-
|
346
|
-
as columns.
|
354
|
+
Fixes #22584.
|
347
355
|
|
348
|
-
|
356
|
+
*Yves Senn*
|
349
357
|
|
350
|
-
|
358
|
+
* Use `version` column as primary key for schema_migrations table because
|
359
|
+
`schema_migrations` versions are guaranteed to be unique.
|
351
360
|
|
352
|
-
|
361
|
+
This makes it possible to use `update_attributes` on models that do
|
362
|
+
not have a primary key.
|
353
363
|
|
354
|
-
*
|
364
|
+
*Richard Schneeman*
|
355
365
|
|
356
|
-
*
|
357
|
-
underlying `has_many :through`.
|
366
|
+
* Add short-hand methods for text and blob types in MySQL.
|
358
367
|
|
359
|
-
|
368
|
+
In Pg and Sqlite3, `:text` and `:binary` have variable unlimited length.
|
369
|
+
But in MySQL, these have limited length for each types (ref #21591, #21619).
|
370
|
+
This change adds short-hand methods for each text and blob types.
|
360
371
|
|
361
|
-
|
372
|
+
Example:
|
362
373
|
|
363
|
-
|
374
|
+
create_table :foos do |t|
|
375
|
+
t.tinyblob :tiny_blob
|
376
|
+
t.mediumblob :medium_blob
|
377
|
+
t.longblob :long_blob
|
378
|
+
t.tinytext :tiny_text
|
379
|
+
t.mediumtext :medium_text
|
380
|
+
t.longtext :long_text
|
381
|
+
end
|
364
382
|
|
365
|
-
*
|
366
|
-
environment. This ensures that initializers are run.
|
383
|
+
*Ryuta Kamizono*
|
367
384
|
|
368
|
-
|
385
|
+
* Take into account UTC offset when assigning string representation of
|
386
|
+
timestamp with offset specified to attribute of time type.
|
369
387
|
|
370
|
-
*
|
388
|
+
*Andrey Novikov*
|
371
389
|
|
372
|
-
*
|
390
|
+
* When calling `first` with a `limit` argument, return directly from the
|
391
|
+
`loaded?` records if available.
|
373
392
|
|
374
|
-
|
375
|
-
`column` definitions for `created_at` and `updated_at` rather than just
|
376
|
-
the first.
|
393
|
+
*Ben Woosley*
|
377
394
|
|
378
|
-
|
395
|
+
* Deprecate sending the `offset` argument to `find_nth`. Please use the
|
396
|
+
`offset` method on relation instead.
|
379
397
|
|
380
|
-
*
|
398
|
+
*Ben Woosley*
|
381
399
|
|
382
|
-
|
400
|
+
* Limit record touching to once per transaction.
|
383
401
|
|
384
|
-
|
402
|
+
If you have a parent/grand-parent relation like:
|
385
403
|
|
386
|
-
|
387
|
-
|
404
|
+
Comment belongs_to :message, touch: true
|
405
|
+
Message belongs_to :project, touch: true
|
406
|
+
Project belongs_to :account, touch: true
|
388
407
|
|
389
|
-
|
408
|
+
When the lowest entry(`Comment`) is saved, now, it won't repeat the touch
|
409
|
+
call multiple times for the parent records.
|
390
410
|
|
391
|
-
|
392
|
-
`ActiveRecord::Base.pluralize_table_names = false`.
|
411
|
+
Related #18606.
|
393
412
|
|
394
|
-
|
413
|
+
*arthurnn*
|
395
414
|
|
396
|
-
|
415
|
+
* Order the result of `find(ids)` to match the passed array, if the relation
|
416
|
+
has no explicit order defined.
|
397
417
|
|
398
|
-
|
418
|
+
Fixes #20338.
|
399
419
|
|
400
|
-
|
420
|
+
*Miguel Grazziotin*, *Matthew Draper*
|
401
421
|
|
402
|
-
|
422
|
+
* Omit default limit values in dumped schema. It's tidier, and if the defaults
|
423
|
+
change in the future, we can address that via Migration API Versioning.
|
403
424
|
|
404
|
-
*
|
405
|
-
association (only when calling calculation methods).
|
425
|
+
*Jean Boussier*
|
406
426
|
|
407
|
-
|
427
|
+
* Support passing the schema name as a prefix to table name in
|
428
|
+
`ConnectionAdapters::SchemaStatements#indexes`. Previously the prefix would
|
429
|
+
be considered a full part of the index name, and only the schema in the
|
430
|
+
current search path would be considered.
|
408
431
|
|
409
|
-
*
|
432
|
+
*Grey Baker*
|
410
433
|
|
411
|
-
*
|
434
|
+
* Ignore index name in `index_exists?` and `remove_index` when not passed a
|
435
|
+
name to check for.
|
412
436
|
|
413
|
-
|
437
|
+
*Grey Baker*
|
414
438
|
|
415
|
-
|
439
|
+
* Extract support for the legacy `mysql` database adapter from core. It will
|
440
|
+
live on in a separate gem for now, but most users should just use `mysql2`.
|
416
441
|
|
417
|
-
*
|
418
|
-
its default value by an in-place modification.
|
442
|
+
*Abdelkader Boudih*
|
419
443
|
|
420
|
-
|
444
|
+
* ApplicationRecord is a new superclass for all app models, analogous to app
|
445
|
+
controllers subclassing ApplicationController instead of
|
446
|
+
ActionController::Base. This gives apps a single spot to configure app-wide
|
447
|
+
model behavior.
|
421
448
|
|
422
|
-
|
449
|
+
Newly generated applications have `app/models/application_record.rb`
|
450
|
+
present by default.
|
423
451
|
|
424
|
-
*
|
452
|
+
*Genadi Samokovarov*
|
425
453
|
|
426
|
-
|
454
|
+
* Version the API presented to migration classes, so we can change parameter
|
455
|
+
defaults without breaking existing migrations, or forcing them to be
|
456
|
+
rewritten through a deprecation cycle.
|
427
457
|
|
428
|
-
|
429
|
-
That was causing a memory grow problem when creating a lot of records inside a transaction.
|
458
|
+
New migrations specify the Rails version they were written for:
|
430
459
|
|
431
|
-
|
460
|
+
class AddStatusToOrders < ActiveRecord::Migration[5.0]
|
461
|
+
def change
|
462
|
+
# ...
|
463
|
+
end
|
464
|
+
end
|
432
465
|
|
433
|
-
*
|
466
|
+
*Matthew Draper*, *Ravil Bayramgalin*
|
434
467
|
|
435
|
-
*
|
436
|
-
|
468
|
+
* Use bind params for `limit` and `offset`. This will generate significantly
|
469
|
+
fewer prepared statements for common tasks like pagination. To support this
|
470
|
+
change, passing a string containing a comma to `limit` has been deprecated,
|
471
|
+
and passing an Arel node to `limit` is no longer supported.
|
437
472
|
|
438
|
-
Fixes #
|
473
|
+
Fixes #22250.
|
439
474
|
|
440
475
|
*Sean Griffin*
|
441
476
|
|
477
|
+
* Introduce after_{create,update,delete}_commit callbacks.
|
442
478
|
|
443
|
-
|
479
|
+
Before:
|
444
480
|
|
445
|
-
|
481
|
+
after_commit :add_to_index_later, on: :create
|
482
|
+
after_commit :update_in_index_later, on: :update
|
483
|
+
after_commit :remove_from_index_later, on: :destroy
|
446
484
|
|
485
|
+
After:
|
447
486
|
|
448
|
-
|
487
|
+
after_create_commit :add_to_index_later
|
488
|
+
after_update_commit :update_in_index_later
|
489
|
+
after_destroy_commit :remove_from_index_later
|
449
490
|
|
450
|
-
|
491
|
+
Fixes #22515.
|
451
492
|
|
452
|
-
|
493
|
+
*Genadi Samokovarov*
|
453
494
|
|
454
|
-
|
495
|
+
* Respect the column default values for `inheritance_column` when
|
496
|
+
instantiating records through the base class.
|
455
497
|
|
456
|
-
|
457
|
-
removing the column. This fixes a bug where it was not possible to remove
|
458
|
-
the column on MySQL.
|
459
|
-
|
460
|
-
Fixes #18664.
|
498
|
+
Fixes #17121.
|
461
499
|
|
462
|
-
|
463
|
-
|
464
|
-
* Add a `:foreign_key` option to `references` and associated migration
|
465
|
-
methods. The model and migration generators now use this option, rather than
|
466
|
-
the `add_foreign_key` form.
|
500
|
+
Example:
|
467
501
|
|
468
|
-
|
502
|
+
# The schema of BaseModel has `t.string :type, default: 'SubType'`
|
503
|
+
subtype = BaseModel.new
|
504
|
+
assert_equals SubType, subtype.class
|
469
505
|
|
470
|
-
*
|
506
|
+
*Kuldeep Aggarwal*
|
471
507
|
|
472
|
-
|
473
|
-
the precision of timestamp column.
|
508
|
+
* Fix `rake db:structure:dump` on Postgres when multiple schemas are used.
|
474
509
|
|
475
|
-
|
510
|
+
Fixes #22346.
|
476
511
|
|
477
|
-
*
|
512
|
+
*Nick Muerdter*, *ckoenig*
|
478
513
|
|
479
|
-
|
480
|
-
on the database default charset and collation rather than the encoding
|
481
|
-
of the connection.
|
514
|
+
* Add schema dumping support for PostgreSQL geometric data types.
|
482
515
|
|
483
516
|
*Ryuta Kamizono*
|
484
517
|
|
485
|
-
*
|
486
|
-
|
487
|
-
Fixes #18813.
|
488
|
-
|
489
|
-
*Sean Griffin*
|
490
|
-
|
491
|
-
* Fixed several edge cases which could result in a counter cache updating
|
492
|
-
twice or not updating at all for `has_many` and `has_many :through`.
|
493
|
-
|
494
|
-
Fixes #10865.
|
495
|
-
|
496
|
-
*Sean Griffin*
|
497
|
-
|
498
|
-
* Foreign keys added by migrations were given random, generated names. This
|
499
|
-
meant a different `structure.sql` would be generated every time a developer
|
500
|
-
ran migrations on their machine.
|
501
|
-
|
502
|
-
The generated part of foreign key names is now a hash of the table name and
|
503
|
-
column name, which is consistent every time you run the migration.
|
518
|
+
* Except keys of `build_record`'s argument from `create_scope` in `initialize_attributes`.
|
504
519
|
|
505
|
-
|
520
|
+
Fixes #21893.
|
506
521
|
|
507
|
-
*
|
522
|
+
*Yuichiro Kaneko*
|
508
523
|
|
509
|
-
|
510
|
-
|
524
|
+
* Deprecate `connection.tables` on the SQLite3 and MySQL adapters.
|
525
|
+
Also deprecate passing arguments to `#tables`.
|
526
|
+
And deprecate `table_exists?`.
|
511
527
|
|
512
|
-
|
528
|
+
The `#tables` method of some adapters (mysql, mysql2, sqlite3) would return
|
529
|
+
both tables and views while others (postgresql) just return tables. To make
|
530
|
+
their behavior consistent, `#tables` will return only tables in the future.
|
513
531
|
|
514
|
-
|
515
|
-
|
532
|
+
The `#table_exists?` method would check both tables and views. To make
|
533
|
+
their behavior consistent with `#tables`, `#table_exists?` will check only
|
534
|
+
tables in the future.
|
516
535
|
|
517
|
-
|
536
|
+
*Yuichiro Kaneko*
|
518
537
|
|
519
|
-
|
538
|
+
* Improve support for non Active Record objects on `validates_associated`
|
520
539
|
|
521
|
-
|
522
|
-
|
540
|
+
Skipping `marked_for_destruction?` when the associated object does not responds
|
541
|
+
to it make easier to validate virtual associations built on top of Active Model
|
542
|
+
objects and/or serialized objects that implement a `valid?` instance method.
|
523
543
|
|
524
|
-
|
525
|
-
commit message from the commit which added this line for some examples.
|
526
|
-
|
527
|
-
*Sean Griffin*
|
528
|
-
|
529
|
-
* Values which would error while being sent to the database (such as an
|
530
|
-
ASCII-8BIT string with invalid UTF-8 bytes on Sqlite3), no longer error on
|
531
|
-
assignment. They will still error when sent to the database, but you are
|
532
|
-
given the ability to re-assign it to a valid value.
|
544
|
+
*Kassio Borges*, *Lucas Mazza*
|
533
545
|
|
534
|
-
|
535
|
-
|
536
|
-
*Sean Griffin*
|
546
|
+
* Change connection management middleware to return a new response with
|
547
|
+
a body proxy, rather than mutating the original.
|
537
548
|
|
538
|
-
*
|
549
|
+
*Kevin Buchanan*
|
539
550
|
|
540
|
-
|
551
|
+
* Make `db:migrate:status` to render `1_some.rb` format migrate files.
|
541
552
|
|
542
|
-
|
553
|
+
These files are in `db/migrate`:
|
543
554
|
|
544
|
-
*
|
555
|
+
* 1_valid_people_have_last_names.rb
|
556
|
+
* 20150819202140_irreversible_migration.rb
|
557
|
+
* 20150823202140_add_admin_flag_to_users.rb
|
558
|
+
* 20150823202141_migration_tests.rb
|
559
|
+
* 2_we_need_reminders.rb
|
560
|
+
* 3_innocent_jointable.rb
|
545
561
|
|
546
|
-
|
562
|
+
Before:
|
547
563
|
|
548
|
-
|
564
|
+
$ bundle exec rake db:migrate:status
|
565
|
+
...
|
549
566
|
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
567
|
+
Status Migration ID Migration Name
|
568
|
+
--------------------------------------------------
|
569
|
+
up 001 ********** NO FILE **********
|
570
|
+
up 002 ********** NO FILE **********
|
571
|
+
up 003 ********** NO FILE **********
|
572
|
+
up 20150819202140 Irreversible migration
|
573
|
+
up 20150823202140 Add admin flag to users
|
574
|
+
up 20150823202141 Migration tests
|
554
575
|
|
555
|
-
|
576
|
+
After:
|
556
577
|
|
557
|
-
|
578
|
+
$ bundle exec rake db:migrate:status
|
579
|
+
...
|
558
580
|
|
559
|
-
|
560
|
-
|
581
|
+
Status Migration ID Migration Name
|
582
|
+
--------------------------------------------------
|
583
|
+
up 001 Valid people have last names
|
584
|
+
up 002 We need reminders
|
585
|
+
up 003 Innocent jointable
|
586
|
+
up 20150819202140 Irreversible migration
|
587
|
+
up 20150823202140 Add admin flag to users
|
588
|
+
up 20150823202141 Migration tests
|
561
589
|
|
562
|
-
|
590
|
+
*Yuichiro Kaneko*
|
563
591
|
|
564
|
-
|
592
|
+
* Define `ActiveRecord::Sanitization.sanitize_sql_for_order` and use it inside
|
593
|
+
`preprocess_order_args`.
|
565
594
|
|
566
|
-
*
|
567
|
-
be sent to the database.
|
595
|
+
*Yuichiro Kaneko*
|
568
596
|
|
569
|
-
|
597
|
+
* Allow bigint with default nil for avoiding auto increment primary key.
|
570
598
|
|
571
|
-
*
|
599
|
+
*Ryuta Kamizono*
|
572
600
|
|
573
|
-
*
|
601
|
+
* Remove `DEFAULT_CHARSET` and `DEFAULT_COLLATION` in `MySQLDatabaseTasks`.
|
574
602
|
|
575
|
-
|
603
|
+
We should omit the collation entirely rather than providing a default.
|
604
|
+
Then the choice is the responsibility of the server and MySQL distribution.
|
576
605
|
|
577
|
-
|
578
|
-
is ignored. In 5.6, it's rounded to `2014-08-17 12:30:01`:
|
606
|
+
*Ryuta Kamizono*
|
579
607
|
|
580
|
-
|
608
|
+
* Alias `ActiveRecord::Relation#left_joins` to
|
609
|
+
`ActiveRecord::Relation#left_outer_joins`.
|
581
610
|
|
582
|
-
*
|
611
|
+
*Takashi Kokubun*
|
583
612
|
|
584
|
-
*
|
613
|
+
* Use advisory locking to raise a `ConcurrentMigrationError` instead of
|
614
|
+
attempting to migrate when another migration is currently running.
|
585
615
|
|
586
|
-
*
|
616
|
+
*Sam Davies*
|
587
617
|
|
588
|
-
*
|
618
|
+
* Added `ActiveRecord::Relation#left_outer_joins`.
|
589
619
|
|
590
|
-
|
620
|
+
Example:
|
591
621
|
|
592
|
-
|
622
|
+
User.left_outer_joins(:posts)
|
623
|
+
# => SELECT "users".* FROM "users" LEFT OUTER JOIN "posts" ON
|
624
|
+
"posts"."user_id" = "users"."id"
|
593
625
|
|
594
|
-
|
626
|
+
*Florian Thomas*
|
595
627
|
|
596
|
-
|
628
|
+
* Support passing an array to `order` for SQL parameter sanitization.
|
597
629
|
|
598
|
-
*
|
630
|
+
*Aaron Suggs*
|
599
631
|
|
600
|
-
|
632
|
+
* Avoid disabling errors on the PostgreSQL connection when enabling the
|
633
|
+
`standard_conforming_strings` setting. Errors were previously disabled because
|
634
|
+
the setting wasn't writable in Postgres 8.1 and didn't exist in earlier
|
635
|
+
versions. Now Rails only supports Postgres 8.2+ we're fine to assume the
|
636
|
+
setting exists. Disabling errors caused problems when using a connection
|
637
|
+
pooling tool like PgBouncer because it's not guaranteed to have the same
|
638
|
+
connection between calls to `execute` and it could leave the connection
|
639
|
+
with errors disabled.
|
601
640
|
|
602
|
-
|
641
|
+
Fixes #22101.
|
603
642
|
|
604
|
-
|
643
|
+
*Harry Marr*
|
605
644
|
|
606
|
-
|
645
|
+
* Set `scope.reordering_value` to `true` if `:reordering`-values are specified.
|
607
646
|
|
608
|
-
|
609
|
-
key is missing.
|
647
|
+
Fixes #21886.
|
610
648
|
|
611
|
-
|
649
|
+
*Hiroaki Izu*
|
612
650
|
|
613
|
-
|
651
|
+
* Add support for bidirectional destroy dependencies.
|
614
652
|
|
615
|
-
|
653
|
+
Fixes #13609.
|
616
654
|
|
617
|
-
|
655
|
+
Example:
|
618
656
|
|
619
|
-
|
657
|
+
class Content < ActiveRecord::Base
|
658
|
+
has_one :position, dependent: :destroy
|
659
|
+
end
|
620
660
|
|
621
|
-
|
622
|
-
|
661
|
+
class Position < ActiveRecord::Base
|
662
|
+
belongs_to :content, dependent: :destroy
|
663
|
+
end
|
623
664
|
|
624
|
-
|
665
|
+
*Seb Jacobs*
|
625
666
|
|
626
|
-
|
667
|
+
* Includes HABTM returns correct size now. It's caused by the join dependency
|
668
|
+
only instantiates one HABTM object because the join table hasn't a primary key.
|
627
669
|
|
628
|
-
|
629
|
-
SQLite3 and PostgreSQL adapters was only returning the first field of the key.
|
630
|
-
Ensures that it will return nil instead, as Active Record doesn't support
|
631
|
-
composite primary keys.
|
670
|
+
Fixes #16032.
|
632
671
|
|
633
|
-
|
672
|
+
Examples:
|
634
673
|
|
635
|
-
|
674
|
+
before:
|
636
675
|
|
637
|
-
|
676
|
+
Project.first.salaried_developers.size # => 3
|
677
|
+
Project.includes(:salaried_developers).first.salaried_developers.size # => 1
|
638
678
|
|
639
|
-
|
679
|
+
after:
|
640
680
|
|
641
|
-
|
681
|
+
Project.first.salaried_developers.size # => 3
|
682
|
+
Project.includes(:salaried_developers).first.salaried_developers.size # => 3
|
642
683
|
|
643
|
-
*
|
684
|
+
*Bigxiang*
|
644
685
|
|
645
|
-
|
686
|
+
* Add option to index errors in nested attributes.
|
646
687
|
|
647
|
-
|
648
|
-
|
688
|
+
For models which have nested attributes, errors within those models will
|
689
|
+
now be indexed if `:index_errors` option is set to true when defining a
|
690
|
+
`has_many` relationship or by setting the configuration option
|
691
|
+
`config.active_record.index_nested_attribute_errors` to true.
|
649
692
|
|
650
|
-
|
693
|
+
Example:
|
651
694
|
|
652
|
-
|
653
|
-
|
695
|
+
class Guitar < ActiveRecord::Base
|
696
|
+
has_many :tuning_pegs, index_errors: true
|
697
|
+
accepts_nested_attributes_for :tuning_pegs
|
698
|
+
end
|
654
699
|
|
655
|
-
|
700
|
+
class TuningPeg < ActiveRecord::Base
|
701
|
+
belongs_to :guitar
|
702
|
+
validates_numericality_of :pitch
|
703
|
+
end
|
656
704
|
|
657
|
-
|
705
|
+
# Before
|
706
|
+
guitar.errors["tuning_pegs.pitch"] = ["is not a number"]
|
658
707
|
|
708
|
+
# After
|
709
|
+
guitar.errors["tuning_pegs[1].pitch"] = ["is not a number"]
|
659
710
|
|
660
|
-
|
711
|
+
*Michael Probber*, *Terence Sun*
|
661
712
|
|
662
|
-
*
|
663
|
-
will recreate tables even if they have dependent objects (like foreign keys).
|
664
|
-
`db/schema.rb` now uses `force: :cascade`. This makes it possible to
|
665
|
-
reload the schema when foreign keys are in place.
|
713
|
+
* Exit with non-zero status for failed database rake tasks.
|
666
714
|
|
667
|
-
*
|
715
|
+
*Jay Hayes*
|
668
716
|
|
669
|
-
*
|
670
|
-
|
671
|
-
`
|
717
|
+
* Queries such as `Computer.joins(:monitor).group(:status).count` will now be
|
718
|
+
interpreted as `Computer.joins(:monitor).group('computers.status').count`
|
719
|
+
so that when `Computer` and `Monitor` have both `status` columns we don't
|
720
|
+
have conflicts in projection.
|
672
721
|
|
673
|
-
|
722
|
+
*Rafael Sales*
|
674
723
|
|
675
|
-
|
724
|
+
* Add ability to default to `uuid` as primary key when generating database migrations.
|
676
725
|
|
677
|
-
|
726
|
+
Example:
|
678
727
|
|
679
|
-
|
728
|
+
config.generators do |g|
|
729
|
+
g.orm :active_record, primary_key_type: :uuid
|
730
|
+
end
|
680
731
|
|
681
|
-
*
|
732
|
+
*Jon McCartie*
|
682
733
|
|
683
|
-
|
734
|
+
* Don't cache arguments in `#find_by` if they are an `ActiveRecord::Relation`.
|
684
735
|
|
685
|
-
|
736
|
+
Fixes #20817.
|
686
737
|
|
687
|
-
*
|
688
|
-
options.
|
738
|
+
*Hiroaki Izu*
|
689
739
|
|
690
|
-
|
740
|
+
* Qualify column name inserted by `group` in calculation.
|
691
741
|
|
692
|
-
|
742
|
+
Giving `group` an unqualified column name now works, even if the relation
|
743
|
+
has `JOIN` with another table which also has a column of the name.
|
693
744
|
|
694
|
-
|
695
|
-
when a migration is rolled-back, edited and reapplied.
|
745
|
+
*Soutaro Matsumoto*
|
696
746
|
|
697
|
-
|
698
|
-
|
699
|
-
provide custom behavior after the schema has been loaded.
|
747
|
+
* Don't cache prepared statements containing an IN clause or a SQL literal, as
|
748
|
+
these queries will change often and are unlikely to have a cache hit.
|
700
749
|
|
701
|
-
|
750
|
+
*Sean Griffin*
|
702
751
|
|
703
|
-
|
752
|
+
* Fix `rewhere` in a `has_many` association.
|
704
753
|
|
705
|
-
|
754
|
+
Fixes #21955.
|
706
755
|
|
707
|
-
*
|
756
|
+
*Josh Branchaud*, *Kal*
|
708
757
|
|
709
|
-
|
758
|
+
* `where` raises ArgumentError on unsupported types.
|
710
759
|
|
711
|
-
|
760
|
+
Fixes #20473.
|
712
761
|
|
713
|
-
*
|
762
|
+
*Jake Worth*
|
714
763
|
|
715
|
-
|
764
|
+
* Add an immutable string type to help reduce memory usage for apps which do
|
765
|
+
not need mutation detection on strings.
|
716
766
|
|
717
767
|
*Sean Griffin*
|
718
768
|
|
719
|
-
*
|
769
|
+
* Give `ActiveRecord::Relation#update` its own deprecation warning when
|
770
|
+
passed an `ActiveRecord::Base` instance.
|
720
771
|
|
721
|
-
|
772
|
+
Fixes #21945.
|
722
773
|
|
723
|
-
*
|
724
|
-
conditions on the joined association.
|
774
|
+
*Ted Johansson*
|
725
775
|
|
726
|
-
|
776
|
+
* Make it possible to pass `:to_table` when adding a foreign key through
|
777
|
+
`add_reference`.
|
727
778
|
|
728
|
-
|
779
|
+
Fixes #21563.
|
729
780
|
|
730
|
-
*
|
781
|
+
*Yves Senn*
|
731
782
|
|
732
|
-
*
|
733
|
-
the owner has been saved so that the proxy is not cached without the
|
734
|
-
owner's id.
|
783
|
+
* No longer pass deprecated option `-i` to `pg_dump`.
|
735
784
|
|
736
|
-
*
|
785
|
+
*Paul Sadauskas*
|
737
786
|
|
738
|
-
* `
|
787
|
+
* Concurrent `AR::Base#increment!` and `#decrement!` on the same record
|
788
|
+
are all reflected in the database rather than overwriting each other.
|
739
789
|
|
740
|
-
*
|
790
|
+
*Bogdan Gusiev*
|
741
791
|
|
742
|
-
*
|
792
|
+
* Avoid leaking the first relation we call `first` on, per model.
|
743
793
|
|
744
|
-
Fixes #
|
794
|
+
Fixes #21921.
|
745
795
|
|
746
|
-
*
|
796
|
+
*Matthew Draper*, *Jean Boussier*
|
747
797
|
|
748
|
-
*
|
798
|
+
* Remove unused `pk_and_sequence_for` in `AbstractMysqlAdapter`.
|
749
799
|
|
750
|
-
*
|
800
|
+
*Ryuta Kamizono*
|
751
801
|
|
752
|
-
*
|
753
|
-
`Relation` for performing queries and updates is the prefered API.
|
802
|
+
* Allow fixtures files to set the model class in the YAML file itself.
|
754
803
|
|
755
|
-
|
804
|
+
To load the fixtures file `accounts.yml` as the `User` model, use:
|
756
805
|
|
757
|
-
|
758
|
-
|
806
|
+
_fixture:
|
807
|
+
model_class: User
|
808
|
+
david:
|
809
|
+
name: David
|
759
810
|
|
760
|
-
|
811
|
+
Fixes #9516.
|
761
812
|
|
762
|
-
*
|
763
|
-
in an endless loop.
|
813
|
+
*Roque Pinel*
|
764
814
|
|
765
|
-
|
815
|
+
* Don't require a database connection to load a class which uses acceptance
|
816
|
+
validations.
|
766
817
|
|
767
|
-
*
|
818
|
+
*Sean Griffin*
|
768
819
|
|
769
|
-
*
|
820
|
+
* Correctly apply `unscope` when preloading through associations.
|
770
821
|
|
771
|
-
*
|
822
|
+
*Jimmy Bourassa*
|
772
823
|
|
773
|
-
*
|
824
|
+
* Fixed taking precision into count when assigning a value to timestamp attribute.
|
774
825
|
|
775
|
-
|
826
|
+
Timestamp column can have less precision than ruby timestamp
|
827
|
+
In result in how big a fraction of a second can be stored in the
|
828
|
+
database.
|
776
829
|
|
777
|
-
* Fix `Relation.rewhere` to work with Range values.
|
778
830
|
|
779
|
-
|
831
|
+
m = Model.create!
|
832
|
+
m.created_at.usec == m.reload.created_at.usec # => false
|
833
|
+
# due to different precision in Time.now and database column
|
780
834
|
|
781
|
-
|
835
|
+
If the precision is low enough, (mysql default is 0, so it is always low
|
836
|
+
enough by default) the value changes when model is reloaded from the
|
837
|
+
database. This patch fixes that issue ensuring that any timestamp
|
838
|
+
assigned as an attribute is converted to column precision under the
|
839
|
+
attribute.
|
782
840
|
|
783
|
-
|
784
|
-
# => ActiveRecord::UnknownAttributeError: unknown attribute 'name' for User.
|
841
|
+
*Bogdan Gusiev*
|
785
842
|
|
786
|
-
|
843
|
+
* Introduce `connection.data_sources` and `connection.data_source_exists?`.
|
844
|
+
These methods determine what relations can be used to back Active Record
|
845
|
+
models (usually tables and views).
|
787
846
|
|
788
|
-
|
789
|
-
|
847
|
+
Also deprecate `SchemaCache#tables`, `SchemaCache#table_exists?` and
|
848
|
+
`SchemaCache#clear_table_cache!` in favor of their new data source
|
849
|
+
counterparts.
|
790
850
|
|
791
|
-
|
851
|
+
*Yves Senn*, *Matthew Draper*
|
792
852
|
|
793
|
-
|
853
|
+
* Add `ActiveRecord::Base.ignored_columns` to make some columns
|
854
|
+
invisible from Active Record.
|
794
855
|
|
795
|
-
*
|
796
|
-
management middleware.
|
856
|
+
*Jean Boussier*
|
797
857
|
|
798
|
-
|
858
|
+
* `ActiveRecord::Tasks::MySQLDatabaseTasks` fails if shellout to
|
859
|
+
mysql commands (like `mysqldump`) is not successful.
|
799
860
|
|
800
|
-
*
|
861
|
+
*Steve Mitchell*
|
801
862
|
|
802
|
-
|
863
|
+
* Ensure `select` quotes aliased attributes, even when using `from`.
|
803
864
|
|
804
|
-
|
865
|
+
Fixes #21488.
|
805
866
|
|
806
|
-
*
|
867
|
+
*Sean Griffin*, *@johanlunds*
|
807
868
|
|
808
|
-
*
|
869
|
+
* MySQL: support `unsigned` numeric data types.
|
809
870
|
|
810
|
-
|
871
|
+
Example:
|
811
872
|
|
812
|
-
|
813
|
-
|
873
|
+
create_table :foos do |t|
|
874
|
+
t.unsigned_integer :quantity
|
875
|
+
t.unsigned_bigint :total
|
876
|
+
t.unsigned_float :percentage
|
877
|
+
t.unsigned_decimal :price, precision: 10, scale: 2
|
878
|
+
end
|
814
879
|
|
815
|
-
|
880
|
+
The `unsigned: true` option may be used for the primary key:
|
816
881
|
|
817
|
-
|
882
|
+
create_table :foos, id: :bigint, unsigned: true do |t|
|
883
|
+
…
|
884
|
+
end
|
818
885
|
|
819
|
-
*
|
820
|
-
committing it during the stack unwind. Previously, we could commit half-
|
821
|
-
completed work. This fix only works for Ruby 2.0+; on 1.9, we can't
|
822
|
-
distinguish a thread kill from an ordinary non-local (block) return, so must
|
823
|
-
default to committing.
|
886
|
+
*Ryuta Kamizono*
|
824
887
|
|
825
|
-
|
888
|
+
* Add `#views` and `#view_exists?` methods on connection adapters.
|
826
889
|
|
827
|
-
*
|
828
|
-
`Comment.where(post_id: Post.none)` returned a non-empty result.
|
890
|
+
*Ryuta Kamizono*
|
829
891
|
|
830
|
-
|
892
|
+
* Correctly dump composite primary key.
|
831
893
|
|
832
|
-
|
894
|
+
Example:
|
833
895
|
|
834
|
-
|
835
|
-
|
896
|
+
create_table :barcodes, primary_key: ["region", "code"] do |t|
|
897
|
+
t.string :region
|
898
|
+
t.integer :code
|
899
|
+
end
|
836
900
|
|
837
|
-
*
|
901
|
+
*Ryuta Kamizono*
|
838
902
|
|
839
|
-
*
|
903
|
+
* Lookup the attribute name for `restrict_with_error` messages on the
|
904
|
+
model class that defines the association.
|
840
905
|
|
841
|
-
*
|
906
|
+
*kuboon*, *Ronak Jangir*
|
842
907
|
|
843
|
-
*
|
908
|
+
* Correct query for PostgreSQL 8.2 compatibility.
|
844
909
|
|
845
|
-
*
|
910
|
+
*Ben Murphy*, *Matthew Draper*
|
846
911
|
|
847
|
-
*
|
912
|
+
* `bin/rails db:migrate` uses
|
913
|
+
`ActiveRecord::Tasks::DatabaseTasks.migrations_paths` instead of
|
914
|
+
`Migrator.migrations_paths`.
|
848
915
|
|
849
|
-
*
|
916
|
+
*Tobias Bielohlawek*
|
850
917
|
|
851
|
-
*
|
852
|
-
has support for SQL views. Connection adapters should define this method.
|
918
|
+
* Support dropping indexes concurrently in PostgreSQL.
|
853
919
|
|
854
|
-
|
920
|
+
See http://www.postgresql.org/docs/9.4/static/sql-dropindex.html for more
|
921
|
+
details.
|
855
922
|
|
856
|
-
*
|
923
|
+
*Grey Baker*
|
857
924
|
|
858
|
-
|
925
|
+
* Deprecate passing conditions to `ActiveRecord::Relation#delete_all`
|
926
|
+
and `ActiveRecord::Relation#destroy_all`.
|
859
927
|
|
860
|
-
*
|
928
|
+
*Wojciech Wnętrzak*
|
861
929
|
|
862
|
-
*
|
863
|
-
|
930
|
+
* Instantiating an AR model with `ActionController::Parameters` now raises
|
931
|
+
an `ActiveModel::ForbiddenAttributesError` if the parameters include a
|
932
|
+
`type` field that has not been explicitly permitted. Previously, the
|
933
|
+
`type` field was simply ignored in the same situation.
|
864
934
|
|
865
|
-
|
935
|
+
*Prem Sichanugrist*
|
866
936
|
|
867
|
-
|
937
|
+
* PostgreSQL, `create_schema`, `drop_schema` and `rename_table` now quote
|
938
|
+
schema names.
|
868
939
|
|
869
|
-
|
940
|
+
Fixes #21418.
|
870
941
|
|
871
|
-
|
872
|
-
database.yml. Otherwise, `SET NAMES utf8mb4` will use the default
|
873
|
-
collation for that charset (utf8mb4_general_ci) when you may have chosen
|
874
|
-
a different collation, like utf8mb4_unicode_ci.
|
942
|
+
Example:
|
875
943
|
|
876
|
-
|
877
|
-
|
944
|
+
create_schema("my.schema")
|
945
|
+
# CREATE SCHEMA "my.schema";
|
878
946
|
|
879
|
-
*
|
947
|
+
*Yves Senn*
|
880
948
|
|
881
|
-
* `
|
949
|
+
* PostgreSQL, add `:if_exists` option to `#drop_schema`. This makes it
|
950
|
+
possible to drop a schema that might exist without raising an exception if
|
951
|
+
it doesn't.
|
882
952
|
|
883
953
|
*Yves Senn*
|
884
954
|
|
885
|
-
*
|
886
|
-
|
955
|
+
* Only try to nullify has_one target association if the record is persisted.
|
956
|
+
|
957
|
+
Fixes #21223.
|
887
958
|
|
888
959
|
*Agis Anastasopoulos*
|
889
960
|
|
890
|
-
|
961
|
+
* Uniqueness validator raises descriptive error when running on a persisted
|
962
|
+
record without primary key.
|
891
963
|
|
892
|
-
|
893
|
-
passed as a lambda with an arity of one.
|
964
|
+
Fixes #21304.
|
894
965
|
|
895
|
-
|
966
|
+
*Yves Senn*
|
896
967
|
|
897
|
-
|
968
|
+
* Add a native JSON data type support in MySQL.
|
898
969
|
|
899
|
-
|
970
|
+
Example:
|
900
971
|
|
901
|
-
|
972
|
+
create_table :json_data_type do |t|
|
973
|
+
t.json :settings
|
974
|
+
end
|
902
975
|
|
903
|
-
*
|
976
|
+
*Ryuta Kamizono*
|
904
977
|
|
905
|
-
*
|
906
|
-
`after_rollback`/`after_create` callbacks and prints them to the logs.
|
907
|
-
Future versions of Rails will not rescue these errors anymore and
|
908
|
-
just bubble them up like the other callbacks.
|
978
|
+
* Descriptive error message when fixtures contain a missing column.
|
909
979
|
|
910
|
-
|
980
|
+
Fixes #21201.
|
911
981
|
|
912
|
-
|
982
|
+
*Yves Senn*
|
913
983
|
|
914
|
-
|
915
|
-
|
984
|
+
* `ActiveRecord::Tasks::PostgreSQLDatabaseTasks` fail if shellout to
|
985
|
+
postgresql commands (like `pg_dump`) is not successful.
|
916
986
|
|
917
|
-
|
987
|
+
*Bryan Paxton*, *Nate Berkopec*
|
918
988
|
|
919
|
-
|
989
|
+
* Add `ActiveRecord::Relation#in_batches` to work with records and relations
|
990
|
+
in batches.
|
920
991
|
|
921
|
-
|
922
|
-
`enum`) with the same name as a global method are incorrectly overridden
|
923
|
-
when subclassing.
|
992
|
+
Available options are `of` (batch size), `load`, `start`, and `finish`.
|
924
993
|
|
925
|
-
|
994
|
+
Examples:
|
926
995
|
|
927
|
-
|
996
|
+
Person.in_batches.each_record(&:party_all_night!)
|
997
|
+
Person.in_batches.update_all(awesome: true)
|
998
|
+
Person.in_batches.delete_all
|
999
|
+
Person.in_batches.each do |relation|
|
1000
|
+
relation.delete_all
|
1001
|
+
sleep 10 # Throttles the delete queries
|
1002
|
+
end
|
928
1003
|
|
929
|
-
|
930
|
-
well.
|
1004
|
+
Fixes #20933.
|
931
1005
|
|
932
|
-
*
|
1006
|
+
*Sina Siadat*
|
933
1007
|
|
934
|
-
*
|
1008
|
+
* Added methods for PostgreSQL geometric data types to use in migrations.
|
935
1009
|
|
936
|
-
|
1010
|
+
Example:
|
937
1011
|
|
938
|
-
|
1012
|
+
create_table :foo do |t|
|
1013
|
+
t.line :foo_line
|
1014
|
+
t.lseg :foo_lseg
|
1015
|
+
t.box :foo_box
|
1016
|
+
t.path :foo_path
|
1017
|
+
t.polygon :foo_polygon
|
1018
|
+
t.circle :foo_circle
|
1019
|
+
end
|
939
1020
|
|
940
|
-
*
|
1021
|
+
*Mehmet Emin İNAÇ*
|
941
1022
|
|
942
|
-
|
1023
|
+
* Add `cache_key` to ActiveRecord::Relation.
|
943
1024
|
|
944
|
-
|
1025
|
+
Example:
|
945
1026
|
|
946
|
-
|
1027
|
+
@users = User.where("name like ?", "%Alberto%")
|
1028
|
+
@users.cache_key
|
1029
|
+
# => "/users/query-5942b155a43b139f2471b872ac54251f-3-20150714212107656125000"
|
947
1030
|
|
948
|
-
|
1031
|
+
*Alberto Fernández-Capel*
|
949
1032
|
|
950
|
-
|
1033
|
+
* Properly allow uniqueness validations on primary keys.
|
951
1034
|
|
952
|
-
|
953
|
-
index_exists? :articles, :title, name: "idx_title" # => `true`
|
954
|
-
index_exists? :articles, :body, name: "idx_title" # => `true`
|
1035
|
+
Fixes #20966.
|
955
1036
|
|
956
|
-
|
957
|
-
index_exists? :articles, :title, name: "idx_title" # => `true`
|
958
|
-
index_exists? :articles, :body, name: "idx_title" # => `false`
|
1037
|
+
*Sean Griffin*, *presskey*
|
959
1038
|
|
960
|
-
|
1039
|
+
* Don't raise an error if an association failed to destroy when `destroy` was
|
1040
|
+
called on the parent (as opposed to `destroy!`).
|
961
1041
|
|
962
|
-
|
963
|
-
Not passing the option is deprecated but the default is still `null: true`.
|
964
|
-
With Rails 5 this will change to `null: false`.
|
1042
|
+
Fixes #20991.
|
965
1043
|
|
966
1044
|
*Sean Griffin*
|
967
1045
|
|
968
|
-
*
|
969
|
-
|
970
|
-
|
1046
|
+
* `ActiveRecord::RecordNotFound` modified to store model name, primary_key and
|
1047
|
+
id of the caller model. It allows the catcher of this exception to make
|
1048
|
+
a better decision to what to do with it.
|
971
1049
|
|
972
|
-
|
1050
|
+
Example:
|
973
1051
|
|
974
|
-
|
1052
|
+
class SomeAbstractController < ActionController::Base
|
1053
|
+
rescue_from ActiveRecord::RecordNotFound, with: :redirect_to_404
|
975
1054
|
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
1055
|
+
private def redirect_to_404(e)
|
1056
|
+
return redirect_to(posts_url) if e.model == 'Post'
|
1057
|
+
raise
|
1058
|
+
end
|
1059
|
+
end
|
980
1060
|
|
981
|
-
|
1061
|
+
*Sameer Rahmani*
|
982
1062
|
|
983
|
-
|
1063
|
+
* Deprecate the keys for association `restrict_dependent_destroy` errors in favor
|
1064
|
+
of new key names.
|
984
1065
|
|
985
|
-
|
986
|
-
|
987
|
-
|
1066
|
+
Previously `has_one` and `has_many` associations were using the
|
1067
|
+
`one` and `many` keys respectively. Both of these keys have special
|
1068
|
+
meaning in I18n (they are considered to be pluralizations) so by
|
1069
|
+
renaming them to `has_one` and `has_many` we make the messages more explicit
|
1070
|
+
and most importantly they don't clash with linguistical systems that need to
|
1071
|
+
validate translation keys (and their pluralizations).
|
988
1072
|
|
989
|
-
|
1073
|
+
The `:'restrict_dependent_destroy.one'` key should be replaced with
|
1074
|
+
`:'restrict_dependent_destroy.has_one'`, and `:'restrict_dependent_destroy.many'`
|
1075
|
+
with `:'restrict_dependent_destroy.has_many'`.
|
990
1076
|
|
991
|
-
*
|
992
|
-
schema format.
|
1077
|
+
*Roque Pinel*, *Christopher Dell*
|
993
1078
|
|
994
|
-
|
1079
|
+
* Fix state being carried over from previous transaction.
|
995
1080
|
|
996
|
-
|
1081
|
+
Considering the following example where `name` is a required attribute.
|
1082
|
+
Before we had `new_record?` returning `true` for a persisted record:
|
1083
|
+
|
1084
|
+
author = Author.create! name: 'foo'
|
1085
|
+
author.name = nil
|
1086
|
+
author.save # => false
|
1087
|
+
author.new_record? # => true
|
997
1088
|
|
998
|
-
|
1089
|
+
Fixes #20824.
|
999
1090
|
|
1000
|
-
*
|
1091
|
+
*Roque Pinel*
|
1001
1092
|
|
1002
|
-
*
|
1093
|
+
* Correctly ignore `mark_for_destruction` when `autosave` isn't set to `true`
|
1094
|
+
when validating associations.
|
1003
1095
|
|
1004
|
-
|
1005
|
-
source so it has been deprecated. Code that used `source_macro`
|
1006
|
-
was removed in #16353.
|
1096
|
+
Fixes #20882.
|
1007
1097
|
|
1008
|
-
*
|
1098
|
+
*Sean Griffin*
|
1009
1099
|
|
1010
|
-
*
|
1100
|
+
* Fix a bug where counter_cache doesn't always work with polymorphic
|
1101
|
+
relations.
|
1011
1102
|
|
1012
|
-
Fixes #
|
1103
|
+
Fixes #16407.
|
1013
1104
|
|
1014
|
-
*
|
1105
|
+
*Stefan Kanev*, *Sean Griffin*
|
1015
1106
|
|
1016
|
-
*
|
1107
|
+
* Ensure that cyclic associations with autosave don't cause duplicate errors
|
1108
|
+
to be added to the parent record.
|
1017
1109
|
|
1018
|
-
|
1110
|
+
Fixes #20874.
|
1019
1111
|
|
1020
|
-
|
1021
|
-
t.jsonb :meta_data
|
1022
|
-
end
|
1112
|
+
*Sean Griffin*
|
1023
1113
|
|
1024
|
-
|
1114
|
+
* Ensure that `ActionController::Parameters` can still be passed to nested
|
1115
|
+
attributes.
|
1025
1116
|
|
1026
|
-
|
1117
|
+
Fixes #20922.
|
1027
1118
|
|
1028
|
-
*
|
1119
|
+
*Sean Griffin*
|
1029
1120
|
|
1030
|
-
*
|
1031
|
-
|
1121
|
+
* Deprecate force association reload by passing a truthy argument to
|
1122
|
+
association method.
|
1032
1123
|
|
1033
|
-
|
1124
|
+
For collection association, you can call `#reload` on association proxy to
|
1125
|
+
force a reload:
|
1034
1126
|
|
1035
|
-
|
1127
|
+
@user.posts.reload # Instead of @user.posts(true)
|
1036
1128
|
|
1037
|
-
|
1038
|
-
|
1129
|
+
For singular association, you can call `#reload` on the parent object to
|
1130
|
+
clear its association cache then call the association method:
|
1039
1131
|
|
1040
|
-
|
1132
|
+
@user.reload.profile # Instead of @user.profile(true)
|
1041
1133
|
|
1042
|
-
|
1043
|
-
|
1044
|
-
end
|
1134
|
+
Passing a truthy argument to force association to reload will be removed in
|
1135
|
+
Rails 5.1.
|
1045
1136
|
|
1046
|
-
*
|
1137
|
+
*Prem Sichanugrist*
|
1047
1138
|
|
1048
|
-
* `
|
1049
|
-
|
1139
|
+
* Replaced `ActiveSupport::Concurrency::Latch` with `Concurrent::CountDownLatch`
|
1140
|
+
from the concurrent-ruby gem.
|
1050
1141
|
|
1051
|
-
|
1142
|
+
*Jerry D'Antonio*
|
1052
1143
|
|
1053
|
-
|
1144
|
+
* Fix through associations using scopes having the scope merged multiple
|
1145
|
+
times.
|
1146
|
+
|
1147
|
+
Fixes #20721.
|
1148
|
+
Fixes #20727.
|
1054
1149
|
|
1055
|
-
*
|
1056
|
-
a class.
|
1150
|
+
*Sean Griffin*
|
1057
1151
|
|
1058
|
-
|
1152
|
+
* `ActiveRecord::Base.dump_schema_after_migration` applies migration tasks
|
1153
|
+
other than `db:migrate`. (eg. `db:rollback`, `db:migrate:dup`, ...)
|
1059
1154
|
|
1060
|
-
|
1155
|
+
Fixes #20743.
|
1061
1156
|
|
1062
|
-
*
|
1157
|
+
*Yves Senn*
|
1063
1158
|
|
1064
|
-
*
|
1159
|
+
* Add alternate syntax to make `change_column_default` reversible.
|
1065
1160
|
|
1066
|
-
|
1067
|
-
|
1161
|
+
User can pass in `:from` and `:to` to make `change_column_default` command
|
1162
|
+
become reversible.
|
1068
1163
|
|
1069
1164
|
Example:
|
1070
1165
|
|
1071
|
-
|
1072
|
-
|
1073
|
-
end
|
1166
|
+
change_column_default :posts, :status, from: nil, to: "draft"
|
1167
|
+
change_column_default :users, :authorized, from: true, to: false
|
1074
1168
|
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1169
|
+
*Prem Sichanugrist*
|
1170
|
+
|
1171
|
+
* Prevent error when using `force_reload: true` on an unassigned polymorphic
|
1172
|
+
belongs_to association.
|
1079
1173
|
|
1080
|
-
|
1081
|
-
post.comment = Comment.new(category: "Animals", text: "This is a comment about squirrels.")
|
1082
|
-
post.save!
|
1174
|
+
Fixes #20426.
|
1083
1175
|
|
1084
|
-
|
1085
|
-
post.comment # => {"category"=>"Animals", "text"=>"This is a comment about squirrels."}
|
1176
|
+
*James Dabbs*
|
1086
1177
|
|
1087
|
-
|
1088
|
-
|
1178
|
+
* Correctly raise `ActiveRecord::AssociationTypeMismatch` when assigning
|
1179
|
+
a wrong type to a namespaced association.
|
1089
1180
|
|
1090
|
-
|
1091
|
-
post.comment # => {"category"=>"Animals", "text"=>"This is a comment about squirrels."}
|
1181
|
+
Fixes #20545.
|
1092
1182
|
|
1093
|
-
|
1094
|
-
new `ActiveRecord::Coders::JSON` coder which delegates its `dump/load` to
|
1095
|
-
`ActiveSupport::JSON.encode/decode`. This ensures special objects are dumped
|
1096
|
-
correctly using the `#as_json` hook.
|
1183
|
+
*Diego Carrion*
|
1097
1184
|
|
1098
|
-
|
1099
|
-
([example](https://gist.github.com/jenncoop/8c4142bbe59da77daa63)).
|
1185
|
+
* `validates_absence_of` respects `marked_for_destruction?`.
|
1100
1186
|
|
1101
|
-
Fixes #
|
1187
|
+
Fixes #20449.
|
1102
1188
|
|
1103
|
-
*
|
1189
|
+
*Yves Senn*
|
1104
1190
|
|
1105
|
-
*
|
1191
|
+
* Include the `Enumerable` module in `ActiveRecord::Relation`
|
1106
1192
|
|
1107
|
-
|
1193
|
+
*Sean Griffin*, *bogdan*
|
1108
1194
|
|
1109
|
-
|
1195
|
+
* Use `Enumerable#sum` in `ActiveRecord::Relation` if a block is given.
|
1110
1196
|
|
1111
|
-
*
|
1112
|
-
counter cache if one exists.
|
1197
|
+
*Sean Griffin*
|
1113
1198
|
|
1114
|
-
|
1199
|
+
* Let `WITH` queries (Common Table Expressions) be explainable.
|
1115
1200
|
|
1116
|
-
*
|
1117
|
-
primary key with default value of custom PostgreSQL function result.
|
1201
|
+
*Vladimir Kochnev*
|
1118
1202
|
|
1119
|
-
|
1203
|
+
* Make `remove_index :table, :column` reversible.
|
1120
1204
|
|
1121
|
-
*
|
1205
|
+
*Yves Senn*
|
1122
1206
|
|
1123
|
-
*
|
1124
|
-
|
1207
|
+
* Fixed an error which would occur in dirty checking when calling
|
1208
|
+
`update_attributes` from a getter.
|
1125
1209
|
|
1126
|
-
|
1210
|
+
Fixes #20531.
|
1127
1211
|
|
1128
|
-
|
1129
|
-
"categorizations"."category_id" = 1 AND "categorizations"."id" IN (1, 2)
|
1212
|
+
*Sean Griffin*
|
1130
1213
|
|
1131
|
-
|
1214
|
+
* Make `remove_foreign_key` reversible. Any foreign key options must be
|
1215
|
+
specified, similar to `remove_column`.
|
1132
1216
|
|
1133
|
-
|
1134
|
-
"categorizations"."category_id" = 1
|
1217
|
+
*Aster Ryan*
|
1135
1218
|
|
1136
|
-
|
1219
|
+
* Add `:_prefix` and `:_suffix` options to `enum` definition.
|
1137
1220
|
|
1138
|
-
|
1139
|
-
values for string columns. Otherwise, in some database, the string column
|
1140
|
-
values will be coerced to a numeric allowing false or 0.seconds match any
|
1141
|
-
string starting with a non-digit.
|
1221
|
+
Fixes #17511, #17415.
|
1142
1222
|
|
1143
|
-
|
1223
|
+
*Igor Kapkov*
|
1144
1224
|
|
1145
|
-
|
1225
|
+
* Correctly handle decimal arrays with defaults in the schema dumper.
|
1146
1226
|
|
1147
|
-
|
1227
|
+
Fixes #20515.
|
1148
1228
|
|
1149
|
-
*
|
1150
|
-
|
1229
|
+
*Sean Griffin*, *jmondo*
|
1230
|
+
|
1231
|
+
* Deprecate the PostgreSQL `:point` type in favor of a new one which will return
|
1232
|
+
`Point` objects instead of an `Array`
|
1151
1233
|
|
1152
1234
|
*Sean Griffin*
|
1153
1235
|
|
1154
|
-
*
|
1155
|
-
|
1236
|
+
* Ensure symbols passed to `ActiveRecord::Relation#select` are always treated
|
1237
|
+
as columns.
|
1156
1238
|
|
1157
|
-
|
1239
|
+
Fixes #20360.
|
1158
1240
|
|
1159
|
-
*
|
1241
|
+
*Sean Griffin*
|
1160
1242
|
|
1161
|
-
|
1243
|
+
* Do not set `sql_mode` if `strict: :default` is specified.
|
1162
1244
|
|
1163
|
-
|
1245
|
+
# config/database.yml
|
1246
|
+
production:
|
1247
|
+
adapter: mysql2
|
1248
|
+
database: foo_prod
|
1249
|
+
user: foo
|
1250
|
+
strict: :default
|
1164
1251
|
|
1165
|
-
*
|
1252
|
+
*Ryuta Kamizono*
|
1166
1253
|
|
1167
|
-
|
1254
|
+
* Allow proc defaults to be passed to the attributes API. See documentation
|
1255
|
+
for examples.
|
1168
1256
|
|
1169
|
-
*
|
1170
|
-
from `before_destroy` to `after_destroy` callback chain
|
1257
|
+
*Sean Griffin*, *Kir Shatrov*
|
1171
1258
|
|
1172
|
-
|
1259
|
+
* SQLite: `:collation` support for string and text columns.
|
1173
1260
|
|
1174
|
-
|
1261
|
+
Example:
|
1175
1262
|
|
1176
|
-
|
1263
|
+
create_table :foo do |t|
|
1264
|
+
t.string :string_nocase, collation: 'NOCASE'
|
1265
|
+
t.text :text_rtrim, collation: 'RTRIM'
|
1266
|
+
end
|
1177
1267
|
|
1178
|
-
|
1179
|
-
changed in order for it to be persisted in the database. Now it is no longer
|
1180
|
-
required.
|
1268
|
+
add_column :foo, :title, :string, collation: 'RTRIM'
|
1181
1269
|
|
1182
|
-
|
1270
|
+
change_column :foo, :title, :string, collation: 'NOCASE'
|
1183
1271
|
|
1184
|
-
|
1185
|
-
user.name << ' Griffin'
|
1186
|
-
user.name_will_change!
|
1187
|
-
user.save
|
1188
|
-
user.reload.name # => "Sean Griffin"
|
1272
|
+
*Akshay Vishnoi*
|
1189
1273
|
|
1190
|
-
|
1274
|
+
* Allow the use of symbols or strings to specify enum values in test
|
1275
|
+
fixtures:
|
1191
1276
|
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
user.reload.name # => "Sean Griffin"
|
1277
|
+
awdr:
|
1278
|
+
title: "Agile Web Development with Rails"
|
1279
|
+
status: :proposed
|
1196
1280
|
|
1197
|
-
*
|
1281
|
+
*George Claghorn*
|
1282
|
+
|
1283
|
+
* Clear query cache when `ActiveRecord::Base#reload` is called.
|
1198
1284
|
|
1199
|
-
*
|
1200
|
-
is invalid.
|
1285
|
+
*Shane Hender, Pierre Nespo*
|
1201
1286
|
|
1202
|
-
|
1287
|
+
* Include stored procedures and function on the MySQL structure dump.
|
1203
1288
|
|
1204
|
-
*
|
1205
|
-
a part of `schema.rb`. This is supported by Mysql2Adapter, MysqlAdapter
|
1206
|
-
and PostgreSQLAdapter.
|
1289
|
+
*Jonathan Worek*
|
1207
1290
|
|
1208
|
-
|
1209
|
-
|
1291
|
+
* Pass `:extend` option for `has_and_belongs_to_many` associations to the
|
1292
|
+
underlying `has_many :through`.
|
1210
1293
|
|
1211
|
-
|
1294
|
+
*Jaehyun Shin*
|
1295
|
+
|
1296
|
+
* Deprecate `Relation#uniq` use `Relation#distinct` instead.
|
1212
1297
|
|
1213
|
-
|
1214
|
-
add_foreign_key :articles, :authors
|
1215
|
-
remove_foreign_key :articles, :authors
|
1298
|
+
See #9683.
|
1216
1299
|
|
1217
1300
|
*Yves Senn*
|
1218
1301
|
|
1219
|
-
*
|
1220
|
-
|
1302
|
+
* Allow single table inheritance instantiation to work when storing
|
1303
|
+
demodulized class names.
|
1221
1304
|
|
1222
|
-
*
|
1305
|
+
*Alex Robbin*
|
1223
1306
|
|
1224
|
-
*
|
1225
|
-
|
1307
|
+
* Correctly pass MySQL options when using `structure_dump` or
|
1308
|
+
`structure_load`.
|
1226
1309
|
|
1227
|
-
|
1310
|
+
Specifically, it fixes an issue when using SSL authentication.
|
1228
1311
|
|
1229
|
-
*
|
1312
|
+
*Alex Coomans*
|
1230
1313
|
|
1231
|
-
|
1314
|
+
* Correctly dump `:options` on `create_table` for MySQL.
|
1232
1315
|
|
1233
|
-
*
|
1316
|
+
*Ryuta Kamizono*
|
1234
1317
|
|
1235
|
-
*
|
1236
|
-
would fail numericality validation, regardless of the old value. Previously
|
1237
|
-
this would only occur if the old value was 0.
|
1318
|
+
* PostgreSQL: `:collation` support for string and text columns.
|
1238
1319
|
|
1239
1320
|
Example:
|
1240
1321
|
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1322
|
+
create_table :foos do |t|
|
1323
|
+
t.string :string_en, collation: 'en_US.UTF-8'
|
1324
|
+
t.text :text_ja, collation: 'ja_JP.UTF-8'
|
1325
|
+
end
|
1244
1326
|
|
1245
|
-
|
1327
|
+
*Ryuta Kamizono*
|
1246
1328
|
|
1247
|
-
|
1329
|
+
* Remove `ActiveRecord::Serialization::XmlSerializer` from core.
|
1248
1330
|
|
1249
|
-
*
|
1250
|
-
The attribute hash is fully replaced. The record is put into the same state
|
1251
|
-
as it would be with `Model.find(model.id)`.
|
1331
|
+
*Zachary Scott*
|
1252
1332
|
|
1253
|
-
|
1333
|
+
* Make `unscope` aware of "less than" and "greater than" conditions.
|
1254
1334
|
|
1255
|
-
*
|
1256
|
-
If this is not the case a `NoMethodError` is raised.
|
1335
|
+
*TAKAHASHI Kazuaki*
|
1257
1336
|
|
1258
|
-
|
1337
|
+
* `find_by` and `find_by!` raise `ArgumentError` when called without
|
1338
|
+
arguments.
|
1259
1339
|
|
1260
|
-
*
|
1340
|
+
*Kohei Suzuki*
|
1261
1341
|
|
1262
|
-
|
1342
|
+
* Revert behavior of `db:schema:load` back to loading the full
|
1343
|
+
environment. This ensures that initializers are run.
|
1263
1344
|
|
1264
|
-
|
1345
|
+
Fixes #19545.
|
1265
1346
|
|
1266
1347
|
*Yves Senn*
|
1267
1348
|
|
1268
|
-
*
|
1269
|
-
|
1270
|
-
*Sean Griffin*
|
1349
|
+
* Fix missing index when using `timestamps` with the `index` option.
|
1271
1350
|
|
1272
|
-
|
1273
|
-
|
1351
|
+
The `index` option used with `timestamps` should be passed to both
|
1352
|
+
`column` definitions for `created_at` and `updated_at` rather than just
|
1353
|
+
the first.
|
1274
1354
|
|
1275
|
-
|
1355
|
+
*Paul Mucur*
|
1276
1356
|
|
1277
|
-
|
1357
|
+
* Rename `:class` to `:anonymous_class` in association options.
|
1278
1358
|
|
1279
|
-
|
1280
|
-
through association are new.
|
1359
|
+
Fixes #19659.
|
1281
1360
|
|
1282
|
-
*
|
1361
|
+
*Andrew White*
|
1283
1362
|
|
1284
|
-
*
|
1285
|
-
|
1286
|
-
unchanged.
|
1363
|
+
* Autosave existing records on a has many through association when the parent
|
1364
|
+
is new.
|
1287
1365
|
|
1288
|
-
Fixes #
|
1366
|
+
Fixes #19782.
|
1289
1367
|
|
1290
1368
|
*Sean Griffin*
|
1291
1369
|
|
1292
|
-
*
|
1293
|
-
|
1370
|
+
* Fixed a bug where uniqueness validations would error on out of range values,
|
1371
|
+
even if an validation should have prevented it from hitting the database.
|
1294
1372
|
|
1295
|
-
|
1373
|
+
*Andrey Voronkov*
|
1296
1374
|
|
1297
|
-
|
1375
|
+
* MySQL: `:charset` and `:collation` support for string and text columns.
|
1298
1376
|
|
1299
|
-
|
1377
|
+
Example:
|
1300
1378
|
|
1301
|
-
|
1379
|
+
create_table :foos do |t|
|
1380
|
+
t.string :string_utf8_bin, charset: 'utf8', collation: 'utf8_bin'
|
1381
|
+
t.text :text_ascii, charset: 'ascii'
|
1382
|
+
end
|
1302
1383
|
|
1303
|
-
*
|
1384
|
+
*Ryuta Kamizono*
|
1304
1385
|
|
1305
|
-
|
1386
|
+
* Foreign key related methods in the migration DSL respect
|
1387
|
+
`ActiveRecord::Base.pluralize_table_names = false`.
|
1306
1388
|
|
1307
|
-
|
1308
|
-
`Enumerable#find` does.
|
1389
|
+
Fixes #19643.
|
1309
1390
|
|
1310
|
-
|
1391
|
+
*Mehmet Emin İNAÇ*
|
1311
1392
|
|
1312
|
-
|
1393
|
+
* Reduce memory usage from loading types on PostgreSQL.
|
1313
1394
|
|
1314
|
-
|
1395
|
+
Fixes #19578.
|
1315
1396
|
|
1316
|
-
|
1397
|
+
*Sean Griffin*
|
1317
1398
|
|
1318
|
-
|
1399
|
+
* Add `config.active_record.warn_on_records_fetched_greater_than` option.
|
1319
1400
|
|
1320
|
-
|
1321
|
-
|
1401
|
+
When set to an integer, a warning will be logged whenever a result set
|
1402
|
+
larger than the specified size is returned by a query.
|
1322
1403
|
|
1323
|
-
Fixes #
|
1404
|
+
Fixes #16463.
|
1324
1405
|
|
1325
|
-
*
|
1406
|
+
*Jason Nochlin*
|
1326
1407
|
|
1327
|
-
*
|
1408
|
+
* Ignore `.psqlrc` when loading database structure.
|
1328
1409
|
|
1329
|
-
|
1410
|
+
*Jason Weathered*
|
1330
1411
|
|
1331
|
-
|
1412
|
+
* Fix referencing wrong table aliases while joining tables of has many through
|
1413
|
+
association (only when calling calculation methods).
|
1332
1414
|
|
1333
|
-
|
1415
|
+
Fixes #19276.
|
1334
1416
|
|
1335
|
-
|
1336
|
-
updated.
|
1417
|
+
*pinglamb*
|
1337
1418
|
|
1338
|
-
|
1419
|
+
* Correctly persist a serialized attribute that has been returned to
|
1420
|
+
its default value by an in-place modification.
|
1339
1421
|
|
1340
|
-
|
1422
|
+
Fixes #19467.
|
1341
1423
|
|
1342
|
-
*
|
1343
|
-
`proper_table_name` instance method on `ActiveRecord::Migration` instead.
|
1424
|
+
*Matthew Draper*
|
1344
1425
|
|
1345
|
-
|
1426
|
+
* Fix generating the schema file when using PostgreSQL `BigInt[]` data type.
|
1427
|
+
Previously the `limit: 8` was not coming through, and this caused it to
|
1428
|
+
become `Int[]` data type after rebuilding from the schema.
|
1346
1429
|
|
1347
|
-
|
1348
|
-
existing column.
|
1430
|
+
Fixes #19420.
|
1349
1431
|
|
1350
|
-
|
1432
|
+
*Jake Waller*
|
1351
1433
|
|
1352
|
-
|
1434
|
+
* Reuse the `CollectionAssociation#reader` cache when the foreign key is
|
1435
|
+
available prior to save.
|
1353
1436
|
|
1354
|
-
*
|
1355
|
-
It will return a null object in Rails 5.0
|
1437
|
+
*Ben Woosley*
|
1356
1438
|
|
1357
|
-
|
1439
|
+
* Add `config.active_record.dump_schemas` to fix `db:structure:dump`
|
1440
|
+
when using schema_search_path and PostgreSQL extensions.
|
1358
1441
|
|
1359
|
-
|
1442
|
+
Fixes #17157.
|
1360
1443
|
|
1361
|
-
*
|
1444
|
+
*Ryan Wallace*
|
1362
1445
|
|
1363
|
-
*
|
1364
|
-
columns.
|
1446
|
+
* Renaming `use_transactional_fixtures` to `use_transactional_tests` for clarity.
|
1365
1447
|
|
1366
|
-
|
1448
|
+
Fixes #18864.
|
1367
1449
|
|
1368
|
-
*
|
1450
|
+
*Brandon Weiss*
|
1369
1451
|
|
1370
|
-
|
1452
|
+
* Increase pg gem version requirement to `~> 0.18`. Earlier versions of the
|
1453
|
+
pg gem are known to have problems with Ruby 2.2.
|
1371
1454
|
|
1372
|
-
*
|
1455
|
+
*Matt Brictson*
|
1373
1456
|
|
1374
|
-
|
1457
|
+
* Correctly dump `serial` and `bigserial`.
|
1375
1458
|
|
1376
|
-
*
|
1459
|
+
*Ryuta Kamizono*
|
1377
1460
|
|
1378
|
-
|
1461
|
+
* Fix default `format` value in `ActiveRecord::Tasks::DatabaseTasks#schema_file`.
|
1379
1462
|
|
1380
|
-
*
|
1381
|
-
with orders without sort direction modifiers.
|
1463
|
+
*James Cox*
|
1382
1464
|
|
1383
|
-
|
1465
|
+
* Don't enroll records in the transaction if they don't have commit callbacks.
|
1466
|
+
This was causing a memory leak when creating many records inside a transaction.
|
1384
1467
|
|
1385
|
-
|
1468
|
+
Fixes #15549.
|
1386
1469
|
|
1387
|
-
*
|
1470
|
+
*Will Bryant*, *Aaron Patterson*
|
1388
1471
|
|
1389
|
-
*
|
1390
|
-
|
1472
|
+
* Correctly create through records when created on a has many through
|
1473
|
+
association when using `where`.
|
1391
1474
|
|
1392
|
-
Fixes #
|
1475
|
+
Fixes #19073.
|
1393
1476
|
|
1394
|
-
*
|
1477
|
+
*Sean Griffin*
|
1395
1478
|
|
1396
|
-
*
|
1479
|
+
* Add `SchemaMigration.create_table` support for any unicode charsets with MySQL.
|
1397
1480
|
|
1398
|
-
*
|
1481
|
+
*Ryuta Kamizono*
|
1399
1482
|
|
1400
|
-
*
|
1401
|
-
|
1402
|
-
|
1483
|
+
* PostgreSQL no longer disables user triggers if system triggers can't be
|
1484
|
+
disabled. Disabling user triggers does not fulfill what the method promises.
|
1485
|
+
Rails currently requires superuser privileges for this method.
|
1403
1486
|
|
1404
|
-
|
1487
|
+
If you absolutely rely on this behavior, consider patching
|
1488
|
+
`disable_referential_integrity`.
|
1405
1489
|
|
1406
|
-
*
|
1490
|
+
*Yves Senn*
|
1407
1491
|
|
1408
|
-
*
|
1409
|
-
|
1410
|
-
But as `reflections` is a public API, people expect to see the right macro.
|
1492
|
+
* Restore aborted transaction state when `disable_referential_integrity` fails
|
1493
|
+
due to missing permissions.
|
1411
1494
|
|
1412
|
-
|
1495
|
+
*Toby Ovod-Everett*, *Yves Senn*
|
1413
1496
|
|
1414
|
-
|
1497
|
+
* In PostgreSQL, print a warning message if `disable_referential_integrity`
|
1498
|
+
fails due to missing permissions.
|
1415
1499
|
|
1416
|
-
*
|
1500
|
+
*Andrey Nering*, *Yves Senn*
|
1417
1501
|
|
1418
|
-
|
1502
|
+
* Allow a `:limit` option for MySQL bigint primary key support.
|
1419
1503
|
|
1420
|
-
|
1504
|
+
Example:
|
1421
1505
|
|
1422
|
-
|
1423
|
-
|
1506
|
+
create_table :foos, id: :primary_key, limit: 8 do |t|
|
1507
|
+
end
|
1424
1508
|
|
1425
|
-
|
1509
|
+
# or
|
1426
1510
|
|
1427
|
-
|
1428
|
-
|
1511
|
+
create_table :foos, id: false do |t|
|
1512
|
+
t.primary_key :id, limit: 8
|
1513
|
+
end
|
1429
1514
|
|
1430
|
-
*
|
1515
|
+
*Ryuta Kamizono*
|
1431
1516
|
|
1432
|
-
*
|
1517
|
+
* `belongs_to` will now trigger a validation error by default if the association is not present.
|
1518
|
+
You can turn this off on a per-association basis with `optional: true`.
|
1519
|
+
(Note this new default only applies to new Rails apps that will be generated with
|
1520
|
+
`config.active_record.belongs_to_required_by_default = true` in initializer.)
|
1433
1521
|
|
1434
|
-
|
1522
|
+
*Josef Šimánek*
|
1435
1523
|
|
1436
|
-
|
1524
|
+
* Fixed `ActiveRecord::Relation#becomes!` and `changed_attributes` issues for type
|
1525
|
+
columns.
|
1437
1526
|
|
1438
|
-
|
1527
|
+
Fixes #17139.
|
1439
1528
|
|
1440
|
-
|
1441
|
-
record will only be touched if the record was modified. This makes it
|
1442
|
-
consistent with timestamp updating on the record itself.
|
1529
|
+
*Miklos Fazekas*
|
1443
1530
|
|
1444
|
-
|
1531
|
+
* Format the time string according to the precision of the time column.
|
1445
1532
|
|
1446
|
-
*
|
1447
|
-
table inside a schema.
|
1533
|
+
*Ryuta Kamizono*
|
1448
1534
|
|
1449
|
-
|
1535
|
+
* Allow a `:precision` option for time type columns.
|
1450
1536
|
|
1451
|
-
*
|
1537
|
+
*Ryuta Kamizono*
|
1452
1538
|
|
1453
|
-
*
|
1454
|
-
|
1455
|
-
`ActiveRecord`, such as for XML Serialization.
|
1539
|
+
* Add `ActiveRecord::Base.suppress` to prevent the receiver from being saved
|
1540
|
+
during the given block.
|
1456
1541
|
|
1457
|
-
|
1542
|
+
For example, here's a pattern of creating notifications when new comments
|
1543
|
+
are posted. (The notification may in turn trigger an email, a push
|
1544
|
+
notification, or just appear in the UI somewhere):
|
1458
1545
|
|
1459
|
-
|
1460
|
-
|
1546
|
+
class Comment < ActiveRecord::Base
|
1547
|
+
belongs_to :commentable, polymorphic: true
|
1548
|
+
after_create -> { Notification.create! comment: self,
|
1549
|
+
recipients: commentable.recipients }
|
1550
|
+
end
|
1461
1551
|
|
1462
|
-
|
1552
|
+
That's what you want the bulk of the time. A new comment creates a new
|
1553
|
+
Notification. There may be edge cases where you don't want that, like
|
1554
|
+
when copying a commentable and its comments, in which case write a
|
1555
|
+
concern with something like this:
|
1556
|
+
|
1557
|
+
module Copyable
|
1558
|
+
def copy_to(destination)
|
1559
|
+
Notification.suppress do
|
1560
|
+
# Copy logic that creates new comments that we do not want triggering
|
1561
|
+
# notifications.
|
1562
|
+
end
|
1563
|
+
end
|
1564
|
+
end
|
1463
1565
|
|
1464
|
-
*
|
1465
|
-
`references`, now works with any column types.
|
1566
|
+
*Michael Ryan*
|
1466
1567
|
|
1467
|
-
|
1568
|
+
* `:time` option added for `#touch`.
|
1468
1569
|
|
1469
|
-
|
1570
|
+
Fixes #18905.
|
1470
1571
|
|
1471
|
-
*
|
1572
|
+
*Hyonjee Joo*
|
1472
1573
|
|
1473
|
-
*
|
1474
|
-
or `offset`.
|
1574
|
+
* Add `foreign_key_exists?` method.
|
1475
1575
|
|
1476
|
-
|
1477
|
-
records to be deleted.
|
1576
|
+
*Tõnis Simo*
|
1478
1577
|
|
1479
|
-
|
1578
|
+
* Use SQL COUNT and LIMIT 1 queries for `none?` and `one?` methods
|
1579
|
+
if no block or limit is given, instead of loading the entire
|
1580
|
+
collection into memory. This applies to relations (e.g. `User.all`)
|
1581
|
+
as well as associations (e.g. `account.users`)
|
1480
1582
|
|
1481
|
-
|
1583
|
+
# Before:
|
1482
1584
|
|
1483
|
-
|
1484
|
-
|
1585
|
+
users.none?
|
1586
|
+
# SELECT "users".* FROM "users"
|
1485
1587
|
|
1486
|
-
|
1588
|
+
users.one?
|
1589
|
+
# SELECT "users".* FROM "users"
|
1487
1590
|
|
1488
|
-
|
1591
|
+
# After:
|
1489
1592
|
|
1490
|
-
|
1491
|
-
|
1593
|
+
users.none?
|
1594
|
+
# SELECT 1 AS one FROM "users" LIMIT 1
|
1492
1595
|
|
1493
|
-
|
1596
|
+
users.one?
|
1597
|
+
# SELECT COUNT(*) FROM "users"
|
1494
1598
|
|
1495
|
-
*
|
1599
|
+
*Eugene Gilburg*
|
1496
1600
|
|
1497
|
-
* `
|
1498
|
-
|
1601
|
+
* Have `enum` perform type casting consistently with the rest of Active
|
1602
|
+
Record, such as `where`.
|
1499
1603
|
|
1500
|
-
|
1501
|
-
placeholders for them in the generated SQL statement, which can make PostgreSQL
|
1502
|
-
throw a `StatementInvalid` exception.
|
1604
|
+
*Sean Griffin*
|
1503
1605
|
|
1504
|
-
|
1606
|
+
* `scoping` no longer pollutes the current scope of sibling classes when using
|
1607
|
+
STI.
|
1505
1608
|
|
1506
|
-
|
1507
|
-
attributes defined in parent classes.
|
1609
|
+
Fixes #18806.
|
1508
1610
|
|
1509
|
-
|
1611
|
+
Example:
|
1510
1612
|
|
1511
|
-
|
1613
|
+
StiOne.none.scoping do
|
1614
|
+
StiTwo.all
|
1615
|
+
end
|
1512
1616
|
|
1513
|
-
* `change_column_default` allows `[]` as argument to `change_column_default`.
|
1514
1617
|
|
1515
|
-
|
1618
|
+
*Sean Griffin*
|
1516
1619
|
|
1517
|
-
|
1620
|
+
* `remove_reference` with `foreign_key: true` removes the foreign key before
|
1621
|
+
removing the column. This fixes a bug where it was not possible to remove
|
1622
|
+
the column on MySQL.
|
1518
1623
|
|
1519
|
-
|
1624
|
+
Fixes #18664.
|
1520
1625
|
|
1521
|
-
|
1522
|
-
PostgreSQL and are used by internal system catalogs. These field types
|
1523
|
-
can sometimes show up in structure-sniffing queries that feature internal system
|
1524
|
-
structures or with certain PostgreSQL extensions.
|
1626
|
+
*Yves Senn*
|
1525
1627
|
|
1526
|
-
|
1628
|
+
* `find_in_batches` now accepts an `:finish` parameter that complements the `:start`
|
1629
|
+
parameter to specify where to stop batch processing.
|
1527
1630
|
|
1528
|
-
*
|
1529
|
-
NaN PostgreSQL values into a native Ruby `Float::INFINITY` and `Float::NAN`
|
1631
|
+
*Vipul A M*
|
1530
1632
|
|
1531
|
-
|
1633
|
+
* Fix a rounding problem for PostgreSQL timestamp columns.
|
1532
1634
|
|
1533
|
-
|
1534
|
-
|
1635
|
+
If a timestamp column has a precision specified, it needs to
|
1636
|
+
format according to that.
|
1535
1637
|
|
1536
|
-
|
1638
|
+
*Ryuta Kamizono*
|
1537
1639
|
|
1538
|
-
|
1539
|
-
Point.last.value # => Infinity
|
1640
|
+
* Respect the database default charset for `schema_migrations` table.
|
1540
1641
|
|
1541
|
-
|
1642
|
+
The charset of `version` column in `schema_migrations` table depends
|
1643
|
+
on the database default charset and collation rather than the encoding
|
1644
|
+
of the connection.
|
1542
1645
|
|
1543
|
-
*
|
1646
|
+
*Ryuta Kamizono*
|
1544
1647
|
|
1545
|
-
|
1648
|
+
* Raise `ArgumentError` when passing `nil` or `false` to `Relation#merge`.
|
1546
1649
|
|
1547
|
-
|
1650
|
+
These are not valid values to merge in a relation, so it should warn users
|
1651
|
+
early.
|
1548
1652
|
|
1549
|
-
*
|
1550
|
-
associations without replacement. These operations happen before instances
|
1551
|
-
are created. The current behavior is unexpected and can result in broken
|
1552
|
-
behavior.
|
1653
|
+
*Rafael Mendonça França*
|
1553
1654
|
|
1554
|
-
|
1655
|
+
* Use `SCHEMA` instead of `DB_STRUCTURE` for specifying a structure file.
|
1555
1656
|
|
1556
|
-
|
1657
|
+
This makes the `db:structure` tasks consistent with `test:load_structure`.
|
1557
1658
|
|
1558
|
-
*
|
1659
|
+
*Dieter Komendera*
|
1559
1660
|
|
1560
|
-
|
1561
|
-
size calculation if the collection is not cached or loaded.
|
1661
|
+
* Respect custom primary keys for associations when calling `Relation#where`
|
1562
1662
|
|
1563
|
-
Fixes #
|
1663
|
+
Fixes #18813.
|
1564
1664
|
|
1565
|
-
*
|
1665
|
+
*Sean Griffin*
|
1566
1666
|
|
1567
|
-
*
|
1568
|
-
not
|
1667
|
+
* Fix several edge cases which could result in a counter cache updating
|
1668
|
+
twice or not updating at all for `has_many` and `has_many :through`.
|
1569
1669
|
|
1570
|
-
|
1670
|
+
Fixes #10865.
|
1571
1671
|
|
1572
|
-
*
|
1672
|
+
*Sean Griffin*
|
1573
1673
|
|
1574
|
-
|
1575
|
-
|
1674
|
+
* Foreign keys added by migrations were given random, generated names. This
|
1675
|
+
meant a different `structure.sql` would be generated every time a developer
|
1676
|
+
ran migrations on their machine.
|
1576
1677
|
|
1577
|
-
|
1678
|
+
The generated part of foreign key names is now a hash of the table name and
|
1679
|
+
column name, which is consistent every time you run the migration.
|
1578
1680
|
|
1579
|
-
*
|
1681
|
+
*Chris Sinjakli*
|
1580
1682
|
|
1581
|
-
|
1582
|
-
In 4.0 series it is delegated to `Array#join`.
|
1683
|
+
* Fix n+1 query problem when eager loading nil associations (fixes #18312)
|
1583
1684
|
|
1584
|
-
*
|
1685
|
+
*Sammy Larbi*
|
1585
1686
|
|
1586
|
-
*
|
1687
|
+
* Change the default error message from `can't be blank` to `must exist` for
|
1688
|
+
the presence validator of the `:required` option on `belongs_to`/`has_one`
|
1689
|
+
associations.
|
1587
1690
|
|
1588
|
-
|
1589
|
-
in that column, the SQL logger would throw an exception when trying
|
1590
|
-
to log that nil value. This only occurs when updating a record
|
1591
|
-
that already has a non-nil value in that column since an initial nil
|
1592
|
-
value isn't included in the SQL anyway (at least, when dirty checking
|
1593
|
-
is enabled.) The column's new value will now be logged as `<NULL binary data>`
|
1594
|
-
to parallel the existing `<N bytes of binary data>` for non-nil values.
|
1691
|
+
*Henrik Nygren*
|
1595
1692
|
|
1596
|
-
|
1693
|
+
* Fixed `ActiveRecord::Relation#group` method when an argument is an SQL
|
1694
|
+
reserved keyword:
|
1597
1695
|
|
1598
|
-
|
1599
|
-
in order to validate child associations with the same context.
|
1696
|
+
Example:
|
1600
1697
|
|
1601
|
-
|
1698
|
+
SplitTest.group(:key).count
|
1699
|
+
Property.group(:value).count
|
1602
1700
|
|
1603
|
-
*
|
1701
|
+
*Bogdan Gusiev*
|
1604
1702
|
|
1605
|
-
*
|
1703
|
+
* Added the `#or` method on `ActiveRecord::Relation`, allowing use of the OR
|
1704
|
+
operator to combine WHERE or HAVING clauses.
|
1606
1705
|
|
1607
|
-
|
1608
|
-
was ignored and overwritten by strict mode option.
|
1706
|
+
Example:
|
1609
1707
|
|
1610
|
-
|
1708
|
+
Post.where('id = 1').or(Post.where('id = 2'))
|
1709
|
+
# => SELECT * FROM posts WHERE (id = 1) OR (id = 2)
|
1611
1710
|
|
1612
|
-
*
|
1711
|
+
*Sean Griffin*, *Matthew Draper*, *Gael Muller*, *Olivier El Mekki*
|
1613
1712
|
|
1614
|
-
*
|
1713
|
+
* Don't define autosave association callbacks twice from
|
1714
|
+
`accepts_nested_attributes_for`.
|
1615
1715
|
|
1616
|
-
Fixes #
|
1716
|
+
Fixes #18704.
|
1617
1717
|
|
1618
|
-
*
|
1718
|
+
*Sean Griffin*
|
1619
1719
|
|
1620
|
-
*
|
1720
|
+
* Integer types will no longer raise a `RangeError` when assigning an
|
1721
|
+
attribute, but will instead raise when going to the database.
|
1621
1722
|
|
1622
|
-
|
1723
|
+
Fixes several vague issues which were never reported directly. See the
|
1724
|
+
commit message from the commit which added this line for some examples.
|
1623
1725
|
|
1624
|
-
*
|
1625
|
-
on Reflections. This causes a problem when rails loads fixtures, because it
|
1626
|
-
uses the reflections to set database with fixtures.
|
1726
|
+
*Sean Griffin*
|
1627
1727
|
|
1628
|
-
|
1728
|
+
* Values which would error while being sent to the database (such as an
|
1729
|
+
ASCII-8BIT string with invalid UTF-8 bytes on SQLite3), no longer error on
|
1730
|
+
assignment. They will still error when sent to the database, but you are
|
1731
|
+
given the ability to re-assign it to a valid value.
|
1629
1732
|
|
1630
|
-
|
1733
|
+
Fixes #18580.
|
1631
1734
|
|
1632
|
-
*
|
1633
|
-
Additionally display a warning message to make the user aware.
|
1735
|
+
*Sean Griffin*
|
1634
1736
|
|
1635
|
-
|
1737
|
+
* Don't remove join dependencies in `Relation#exists?`
|
1636
1738
|
|
1637
|
-
|
1638
|
-
different spellings of timestamps are treated the same.
|
1739
|
+
Fixes #18632.
|
1639
1740
|
|
1640
|
-
|
1741
|
+
*Sean Griffin*
|
1641
1742
|
|
1642
|
-
|
1643
|
-
# => :datetime
|
1644
|
-
mytimestamp.simplified_type('timestamp(6) without time zone')
|
1645
|
-
# => also :datetime (previously would be :timestamp)
|
1743
|
+
* Invalid values assigned to a JSON column are assumed to be `nil`.
|
1646
1744
|
|
1647
|
-
|
1745
|
+
Fixes #18629.
|
1648
1746
|
|
1649
|
-
*
|
1747
|
+
*Sean Griffin*
|
1650
1748
|
|
1651
|
-
* `ActiveRecord::Base
|
1749
|
+
* Add `ActiveRecord::Base#accessed_fields`, which can be used to quickly
|
1750
|
+
discover which fields were read from a model when you are looking to only
|
1751
|
+
select the data you need from the database.
|
1652
1752
|
|
1653
|
-
|
1753
|
+
*Sean Griffin*
|
1654
1754
|
|
1655
|
-
|
1755
|
+
* Introduce the `:if_exists` option for `drop_table`.
|
1656
1756
|
|
1657
|
-
|
1757
|
+
Example:
|
1658
1758
|
|
1659
|
-
|
1759
|
+
drop_table(:posts, if_exists: true)
|
1660
1760
|
|
1661
|
-
|
1761
|
+
That would execute:
|
1662
1762
|
|
1663
|
-
|
1664
|
-
a scoped `has_many`.
|
1763
|
+
DROP TABLE IF EXISTS posts
|
1665
1764
|
|
1666
|
-
If
|
1667
|
-
`
|
1668
|
-
unexpectedly neglected.
|
1765
|
+
If the table doesn't exist, `if_exists: false` (the default) raises an
|
1766
|
+
exception whereas `if_exists: true` does nothing.
|
1669
1767
|
|
1670
|
-
|
1768
|
+
*Cody Cutrer*, *Stefan Kanev*, *Ryuta Kamizono*
|
1671
1769
|
|
1672
|
-
|
1770
|
+
* Don't run SQL if attribute value is not changed for update_attribute method.
|
1673
1771
|
|
1674
|
-
*
|
1772
|
+
*Prathamesh Sonpatki*
|
1675
1773
|
|
1676
|
-
|
1774
|
+
* `time` columns can now get affected by `time_zone_aware_attributes`. If you have
|
1775
|
+
set `config.time_zone` to a value other than `'UTC'`, they will be treated
|
1776
|
+
as in that time zone by default in Rails 5.1. If this is not the desired
|
1777
|
+
behavior, you can set
|
1677
1778
|
|
1678
|
-
|
1779
|
+
ActiveRecord::Base.time_zone_aware_types = [:datetime]
|
1679
1780
|
|
1680
|
-
|
1781
|
+
A deprecation warning will be emitted if you have a `:time` column, and have
|
1782
|
+
not explicitly opted out.
|
1681
1783
|
|
1682
|
-
|
1784
|
+
Fixes #3145.
|
1683
1785
|
|
1684
|
-
*
|
1786
|
+
*Sean Griffin*
|
1685
1787
|
|
1686
|
-
|
1788
|
+
* Tests now run after_commit callbacks. You no longer have to declare
|
1789
|
+
`uses_transaction ‘test name’` to test the results of an after_commit.
|
1687
1790
|
|
1688
|
-
|
1791
|
+
after_commit callbacks run after committing a transaction whose parent
|
1792
|
+
is not `joinable?`: un-nested transactions, transactions within test cases,
|
1793
|
+
and transactions in `console --sandbox`.
|
1689
1794
|
|
1690
|
-
*
|
1691
|
-
LIKE statement.
|
1795
|
+
*arthurnn*, *Ravil Bayramgalin*, *Matthew Draper*
|
1692
1796
|
|
1693
|
-
|
1797
|
+
* `nil` as a value for a binary column in a query no longer logs as
|
1798
|
+
"<NULL binary data>", and instead logs as just "nil".
|
1694
1799
|
|
1695
|
-
|
1696
|
-
def self.search(term)
|
1697
|
-
where("title LIKE ?", sanitize_sql_like(term))
|
1698
|
-
end
|
1699
|
-
end
|
1800
|
+
*Sean Griffin*
|
1700
1801
|
|
1701
|
-
|
1702
|
-
|
1802
|
+
* `attribute_will_change!` will no longer cause non-persistable attributes to
|
1803
|
+
be sent to the database.
|
1703
1804
|
|
1704
|
-
|
1805
|
+
Fixes #18407.
|
1705
1806
|
|
1706
|
-
*
|
1807
|
+
*Sean Griffin*
|
1707
1808
|
|
1708
|
-
|
1809
|
+
* Remove support for the `protected_attributes` gem.
|
1709
1810
|
|
1710
|
-
*
|
1811
|
+
*Carlos Antonio da Silva*, *Roberto Miranda*
|
1711
1812
|
|
1712
|
-
*
|
1813
|
+
* Fix accessing of fixtures having non-string labels like Fixnum.
|
1713
1814
|
|
1714
|
-
|
1815
|
+
*Prathamesh Sonpatki*
|
1715
1816
|
|
1716
|
-
|
1717
|
-
# => true
|
1718
|
-
Post.where(author_id: author.id) == author.posts
|
1719
|
-
# => true
|
1817
|
+
* Remove deprecated support to preload instance-dependent associations.
|
1720
1818
|
|
1721
|
-
|
1819
|
+
*Yves Senn*
|
1722
1820
|
|
1723
|
-
|
1821
|
+
* Remove deprecated support for PostgreSQL ranges with exclusive lower bounds.
|
1724
1822
|
|
1725
|
-
*
|
1726
|
-
generates an SQL statement containing each id of the collection:
|
1823
|
+
*Yves Senn*
|
1727
1824
|
|
1728
|
-
|
1825
|
+
* Remove deprecation when modifying a relation with cached Arel.
|
1826
|
+
This raises an `ImmutableRelation` error instead.
|
1729
1827
|
|
1730
|
-
|
1731
|
-
AND `model`.`id` IN (1, 2, 3...)
|
1828
|
+
*Yves Senn*
|
1732
1829
|
|
1733
|
-
|
1830
|
+
* Added `ActiveRecord::SecureToken` in order to encapsulate generation of
|
1831
|
+
unique tokens for attributes in a model using `SecureRandom`.
|
1734
1832
|
|
1735
|
-
|
1833
|
+
*Roberto Miranda*
|
1736
1834
|
|
1737
|
-
|
1835
|
+
* Change the behavior of boolean columns to be closer to Ruby's semantics.
|
1738
1836
|
|
1739
|
-
|
1740
|
-
with `select`.
|
1837
|
+
Before this change we had a small set of "truthy", and all others are "falsy".
|
1741
1838
|
|
1742
|
-
|
1839
|
+
Now, we have a small set of "falsy" values and all others are "truthy" matching
|
1840
|
+
Ruby's semantics.
|
1743
1841
|
|
1744
|
-
*
|
1842
|
+
*Rafael Mendonça França*
|
1745
1843
|
|
1746
|
-
*
|
1844
|
+
* Deprecate `ActiveRecord::Base.errors_in_transactional_callbacks=`.
|
1747
1845
|
|
1748
|
-
|
1846
|
+
*Rafael Mendonça França*
|
1749
1847
|
|
1750
|
-
|
1848
|
+
* Change transaction callbacks to not swallow errors.
|
1751
1849
|
|
1752
|
-
|
1753
|
-
|
1850
|
+
Before this change any errors raised inside a transaction callback
|
1851
|
+
were getting rescued and printed in the logs.
|
1754
1852
|
|
1755
|
-
|
1853
|
+
Now these errors are not rescued anymore and just bubble up, as the other callbacks.
|
1756
1854
|
|
1757
|
-
*
|
1855
|
+
*Rafael Mendonça França*
|
1758
1856
|
|
1759
|
-
*
|
1857
|
+
* Remove deprecated `sanitize_sql_hash_for_conditions`.
|
1760
1858
|
|
1761
|
-
|
1859
|
+
*Rafael Mendonça França*
|
1762
1860
|
|
1763
|
-
|
1861
|
+
* Remove deprecated `Reflection#source_macro`.
|
1764
1862
|
|
1765
|
-
*
|
1863
|
+
*Rafael Mendonça França*
|
1766
1864
|
|
1767
|
-
|
1865
|
+
* Remove deprecated `symbolized_base_class` and `symbolized_sti_name`.
|
1768
1866
|
|
1769
|
-
*
|
1867
|
+
*Rafael Mendonça França*
|
1770
1868
|
|
1771
|
-
*
|
1772
|
-
same name in an unrelated class.
|
1869
|
+
* Remove deprecated `ActiveRecord::Base.disable_implicit_join_references=`.
|
1773
1870
|
|
1774
|
-
|
1871
|
+
*Rafael Mendonça França*
|
1775
1872
|
|
1776
|
-
|
1873
|
+
* Remove deprecated access to connection specification using a string accessor.
|
1777
1874
|
|
1778
|
-
|
1875
|
+
Now all strings will be handled as a URL.
|
1779
1876
|
|
1780
|
-
|
1877
|
+
*Rafael Mendonça França*
|
1781
1878
|
|
1782
|
-
|
1879
|
+
* Change the default `null` value for `timestamps` to `false`.
|
1783
1880
|
|
1784
|
-
*
|
1881
|
+
*Rafael Mendonça França*
|
1785
1882
|
|
1786
|
-
|
1883
|
+
* Return an array of pools from `connection_pools`.
|
1787
1884
|
|
1788
|
-
*
|
1885
|
+
*Rafael Mendonça França*
|
1789
1886
|
|
1790
|
-
*
|
1791
|
-
could previously have incorrectly accrued additional conditions (e.g. as a result of
|
1792
|
-
a previous query). `CollectionProxy` now always defers to the association scope's
|
1793
|
-
`arel` method so the (incorrect) inherited one should be entirely concealed.
|
1887
|
+
* Return a null column from `column_for_attribute` when no column exists.
|
1794
1888
|
|
1795
|
-
|
1889
|
+
*Rafael Mendonça França*
|
1796
1890
|
|
1797
|
-
|
1891
|
+
* Remove deprecated `serialized_attributes`.
|
1798
1892
|
|
1799
|
-
*
|
1893
|
+
*Rafael Mendonça França*
|
1800
1894
|
|
1801
|
-
|
1895
|
+
* Remove deprecated automatic counter caches on `has_many :through`.
|
1802
1896
|
|
1803
|
-
|
1897
|
+
*Rafael Mendonça França*
|
1804
1898
|
|
1805
|
-
|
1899
|
+
* Change the way in which callback chains can be halted.
|
1806
1900
|
|
1807
|
-
|
1901
|
+
The preferred method to halt a callback chain from now on is to explicitly
|
1902
|
+
`throw(:abort)`.
|
1903
|
+
In the past, returning `false` in an Active Record `before_` callback had the
|
1904
|
+
side effect of halting the callback chain.
|
1905
|
+
This is not recommended anymore and, depending on the value of the
|
1906
|
+
`ActiveSupport.halt_callback_chains_on_return_false` option, will
|
1907
|
+
either not work at all or display a deprecation warning.
|
1808
1908
|
|
1809
|
-
|
1909
|
+
*claudiob*
|
1810
1910
|
|
1811
|
-
|
1911
|
+
* Clear query cache on rollback.
|
1812
1912
|
|
1813
|
-
*
|
1814
|
-
deprecated in 4.1) from relative to absolute.
|
1913
|
+
*Florian Weingarten*
|
1815
1914
|
|
1816
|
-
|
1817
|
-
`sqlite3:///my/path` with `sqlite3:my/path`.
|
1915
|
+
* Fix setting of foreign_key for through associations when building a new record.
|
1818
1916
|
|
1819
|
-
|
1917
|
+
Fixes #12698.
|
1820
1918
|
|
1821
|
-
*
|
1919
|
+
*Ivan Antropov*
|
1822
1920
|
|
1823
|
-
|
1921
|
+
* Improve dumping of the primary key. If it is not a default primary key,
|
1922
|
+
correctly dump the type and options.
|
1824
1923
|
|
1825
|
-
|
1924
|
+
Fixes #14169, #16599.
|
1826
1925
|
|
1827
|
-
*
|
1926
|
+
*Ryuta Kamizono*
|
1828
1927
|
|
1829
|
-
*
|
1928
|
+
* Format the datetime string according to the precision of the datetime field.
|
1830
1929
|
|
1831
|
-
|
1930
|
+
Incompatible to rounding behavior between MySQL 5.6 and earlier.
|
1832
1931
|
|
1833
|
-
|
1932
|
+
In 5.5, when you insert `2014-08-17 12:30:00.999999` the fractional part
|
1933
|
+
is ignored. In 5.6, it's rounded to `2014-08-17 12:30:01`:
|
1834
1934
|
|
1835
|
-
|
1935
|
+
http://bugs.mysql.com/bug.php?id=68760
|
1836
1936
|
|
1837
|
-
*
|
1838
|
-
The column types stay the same except for enum columns. They no longer have
|
1839
|
-
`nil` as type but `enum`.
|
1937
|
+
*Ryuta Kamizono*
|
1840
1938
|
|
1841
|
-
|
1939
|
+
* Allow a precision option for MySQL datetimes.
|
1842
1940
|
|
1843
|
-
*
|
1941
|
+
*Ryuta Kamizono*
|
1844
1942
|
|
1845
|
-
*
|
1846
|
-
column.
|
1943
|
+
* Fixed automatic `inverse_of` for models nested in a module.
|
1847
1944
|
|
1848
|
-
|
1945
|
+
*Andrew McCloud*
|
1849
1946
|
|
1850
|
-
|
1947
|
+
* Change `ActiveRecord::Relation#update` behavior so that it can
|
1948
|
+
be called without passing ids of the records to be updated.
|
1851
1949
|
|
1852
|
-
|
1853
|
-
|
1950
|
+
This change allows updating multiple records returned by
|
1951
|
+
`ActiveRecord::Relation` with callbacks and validations.
|
1854
1952
|
|
1855
|
-
|
1953
|
+
# Before
|
1954
|
+
# ArgumentError: wrong number of arguments (1 for 2)
|
1955
|
+
Comment.where(group: 'expert').update(body: "Group of Rails Experts")
|
1856
1956
|
|
1857
|
-
|
1957
|
+
# After
|
1958
|
+
# Comments with group expert updated with body "Group of Rails Experts"
|
1959
|
+
Comment.where(group: 'expert').update(body: "Group of Rails Experts")
|
1858
1960
|
|
1859
|
-
*
|
1961
|
+
*Prathamesh Sonpatki*
|
1860
1962
|
|
1861
|
-
|
1963
|
+
* Fix `reaping_frequency` option when the value is a string.
|
1862
1964
|
|
1863
|
-
|
1965
|
+
This usually happens when it is configured using `DATABASE_URL`.
|
1864
1966
|
|
1865
|
-
*
|
1967
|
+
*korbin*
|
1866
1968
|
|
1867
|
-
|
1868
|
-
|
1969
|
+
* Fix error message when trying to create an associated record and the foreign
|
1970
|
+
key is missing.
|
1869
1971
|
|
1870
|
-
|
1871
|
-
required.
|
1972
|
+
Before this fix the following exception was being raised:
|
1872
1973
|
|
1873
|
-
|
1974
|
+
NoMethodError: undefined method `val' for #<Arel::Nodes::BindParam:0x007fc64d19c218>
|
1874
1975
|
|
1875
|
-
|
1876
|
-
t.index :zip
|
1877
|
-
end
|
1878
|
-
# => CREATE TEMPORARY TABLE temp (INDEX (zip)) AS SELECT id, name, zip FROM a_really_complicated_query
|
1976
|
+
Now the message is:
|
1879
1977
|
|
1880
|
-
|
1978
|
+
ActiveRecord::UnknownAttributeError: unknown attribute 'foreign_key' for Model.
|
1881
1979
|
|
1882
|
-
*
|
1883
|
-
`ActiveRecord::Base.pluralize_table_names` is `false`.
|
1980
|
+
*Rafael Mendonça França*
|
1884
1981
|
|
1885
|
-
|
1982
|
+
* Fix change detection problem for PostgreSQL bytea type and
|
1983
|
+
`ArgumentError: string contains null byte` exception with pg-0.18.
|
1886
1984
|
|
1887
|
-
|
1985
|
+
Fixes #17680.
|
1888
1986
|
|
1889
|
-
*
|
1987
|
+
*Lars Kanis*
|
1890
1988
|
|
1891
|
-
|
1989
|
+
* When a table has a composite primary key, the `primary_key` method for
|
1990
|
+
SQLite3 and PostgreSQL adapters was only returning the first field of the key.
|
1991
|
+
Ensures that it will return nil instead, as Active Record doesn't support
|
1992
|
+
composite primary keys.
|
1892
1993
|
|
1893
|
-
|
1894
|
-
Photo.last.touch(:signed_at, :sealed_at)
|
1994
|
+
Fixes #18070.
|
1895
1995
|
|
1896
|
-
*
|
1996
|
+
*arthurnn*
|
1897
1997
|
|
1898
|
-
* `
|
1899
|
-
|
1998
|
+
* `validates_size_of` / `validates_length_of` do not count records
|
1999
|
+
which are `marked_for_destruction?`.
|
1900
2000
|
|
1901
|
-
Fixes #
|
2001
|
+
Fixes #7247.
|
1902
2002
|
|
1903
2003
|
*Yves Senn*
|
1904
2004
|
|
1905
|
-
*
|
1906
|
-
of waiting until they disconnect by themselves. Before this change,
|
1907
|
-
a suitably constructed series of short-lived threads could starve
|
1908
|
-
the connection pool, without ever having more than a couple alive at
|
1909
|
-
the same time.
|
1910
|
-
|
1911
|
-
*Matthew Draper*
|
1912
|
-
|
1913
|
-
* `pk_and_sequence_for` now ensures that only the pg_depend entries
|
1914
|
-
pointing to pg_class, and thus only sequence objects, are considered.
|
1915
|
-
|
1916
|
-
*Josh Williams*
|
2005
|
+
* Ensure `first!` and friends work on loaded associations.
|
1917
2006
|
|
1918
|
-
|
2007
|
+
Fixes #18237.
|
1919
2008
|
|
1920
|
-
|
2009
|
+
*Sean Griffin*
|
1921
2010
|
|
1922
|
-
|
2011
|
+
* `eager_load` preserves readonly flag for associations.
|
1923
2012
|
|
1924
|
-
|
2013
|
+
Fixes #15853.
|
1925
2014
|
|
1926
|
-
|
2015
|
+
*Takashi Kokubun*
|
1927
2016
|
|
1928
|
-
|
1929
|
-
|
2017
|
+
* Provide `:touch` option to `save()` to accommodate saving without updating
|
2018
|
+
timestamps.
|
1930
2019
|
|
1931
|
-
|
2020
|
+
Fixes #18202.
|
1932
2021
|
|
1933
|
-
*
|
2022
|
+
*Dan Olson*
|
1934
2023
|
|
1935
|
-
*
|
2024
|
+
* Provide a more helpful error message when an unsupported class is passed to
|
2025
|
+
`serialize`.
|
1936
2026
|
|
1937
|
-
Fixes #
|
2027
|
+
Fixes #18224.
|
1938
2028
|
|
1939
|
-
*
|
2029
|
+
*Sean Griffin*
|
1940
2030
|
|
1941
|
-
*
|
1942
|
-
Call `.id` on the object first.
|
2031
|
+
* Add bigint primary key support for MySQL.
|
1943
2032
|
|
1944
|
-
|
2033
|
+
Example:
|
1945
2034
|
|
1946
|
-
|
1947
|
-
|
2035
|
+
create_table :foos, id: :bigint do |t|
|
2036
|
+
end
|
1948
2037
|
|
1949
2038
|
*Ryuta Kamizono*
|
1950
2039
|
|
1951
|
-
* Support for
|
2040
|
+
* Support for any type of primary key.
|
1952
2041
|
|
1953
|
-
|
2042
|
+
Fixes #14194.
|
1954
2043
|
|
1955
|
-
*
|
1956
|
-
`where` values without needing to wrap in UPPER/LOWER sql functions.
|
2044
|
+
*Ryuta Kamizono*
|
1957
2045
|
|
1958
|
-
|
2046
|
+
* Dump the default `nil` for PostgreSQL UUID primary key.
|
1959
2047
|
|
1960
|
-
*
|
1961
|
-
Previously after save related callbacks, such as `#after_commit`, were triggered when the has_one
|
1962
|
-
object did not get saved to the db.
|
2048
|
+
*Ryuta Kamizono*
|
1963
2049
|
|
1964
|
-
|
2050
|
+
* Add a `:foreign_key` option to `references` and associated migration
|
2051
|
+
methods. The model and migration generators now use this option, rather than
|
2052
|
+
the `add_foreign_key` form.
|
1965
2053
|
|
1966
|
-
*
|
2054
|
+
*Sean Griffin*
|
1967
2055
|
|
1968
|
-
|
2056
|
+
* Don't raise when writing an attribute with an out-of-range datetime passed
|
2057
|
+
by the user.
|
1969
2058
|
|
1970
|
-
|
2059
|
+
*Grey Baker*
|
1971
2060
|
|
1972
|
-
|
2061
|
+
* Replace deprecated `ActiveRecord::Tasks::DatabaseTasks#load_schema` with
|
2062
|
+
`ActiveRecord::Tasks::DatabaseTasks#load_schema_for`.
|
1973
2063
|
|
1974
|
-
*
|
1975
|
-
warnings on enum columns.
|
2064
|
+
*Yves Senn*
|
1976
2065
|
|
1977
|
-
|
2066
|
+
* Fix bug with `ActiveRecord::Type::Numeric` that caused negative values to
|
2067
|
+
be marked as having changed when set to the same negative value.
|
1978
2068
|
|
1979
|
-
|
1980
|
-
joins are involved.
|
2069
|
+
Fixes #18161.
|
1981
2070
|
|
1982
|
-
|
2071
|
+
*Daniel Fox*
|
1983
2072
|
|
1984
|
-
|
2073
|
+
* Introduce `force: :cascade` option for `create_table`. Using this option
|
2074
|
+
will recreate tables even if they have dependent objects (like foreign keys).
|
2075
|
+
`db/schema.rb` now uses `force: :cascade`. This makes it possible to
|
2076
|
+
reload the schema when foreign keys are in place.
|
1985
2077
|
|
1986
|
-
*
|
1987
|
-
any enum attribute is always evaluated as 0 during uniqueness validation.
|
2078
|
+
*Matthew Draper*, *Yves Senn*
|
1988
2079
|
|
1989
|
-
|
2080
|
+
* `db:schema:load` and `db:structure:load` no longer purge the database
|
2081
|
+
before loading the schema. This is left for the user to do.
|
2082
|
+
`db:test:prepare` will still purge the database.
|
1990
2083
|
|
1991
|
-
|
2084
|
+
Fixes #17945.
|
1992
2085
|
|
1993
|
-
*
|
1994
|
-
`has_and_belongs_to_many` associations *and* on `has_many :through`
|
1995
|
-
associations. Before this change, `before_add` callbacks would be fired
|
1996
|
-
before the record was saved on `has_and_belongs_to_many` associations, but
|
1997
|
-
*not* on `has_many :through` associations.
|
2086
|
+
*Yves Senn*
|
1998
2087
|
|
1999
|
-
|
2088
|
+
* Fix undesirable RangeError by `Type::Integer`. Add `Type::UnsignedInteger`.
|
2000
2089
|
|
2001
|
-
*
|
2002
|
-
private method defined on its ancestors.
|
2090
|
+
*Ryuta Kamizono*
|
2003
2091
|
|
2004
|
-
|
2092
|
+
* Add `foreign_type` option to `has_one` and `has_many` association macros.
|
2005
2093
|
|
2006
|
-
|
2094
|
+
This option enables to define the column name of associated object's type for polymorphic associations.
|
2007
2095
|
|
2008
|
-
*
|
2096
|
+
*Ulisses Almeida*, *Kassio Borges*
|
2009
2097
|
|
2010
|
-
|
2098
|
+
* Remove deprecated behavior allowing nested arrays to be passed as query
|
2099
|
+
values.
|
2011
2100
|
|
2012
|
-
|
2013
|
-
book.save!
|
2014
|
-
book.title # => "12345"
|
2101
|
+
*Melanie Gilman*
|
2015
2102
|
|
2016
|
-
|
2103
|
+
* Deprecate passing a class as a value in a query. Users should pass strings
|
2104
|
+
instead.
|
2017
2105
|
|
2018
|
-
*
|
2019
|
-
We currently map PostgreSQL ranges to Ruby ranges. This conversion is not fully
|
2020
|
-
possible because the Ruby range does not support excluded beginnings.
|
2106
|
+
*Melanie Gilman*
|
2021
2107
|
|
2022
|
-
|
2023
|
-
|
2024
|
-
is not defined) it will raise an `ArgumentException` for ranges with excluding
|
2025
|
-
beginnings.
|
2108
|
+
* `add_timestamps` and `remove_timestamps` now properly reversible with
|
2109
|
+
options.
|
2026
2110
|
|
2027
|
-
*
|
2111
|
+
*Noam Gagliardi-Rabinovich*
|
2028
2112
|
|
2029
|
-
*
|
2113
|
+
* `ActiveRecord::ConnectionAdapters::ColumnDumper#column_spec` and
|
2114
|
+
`ActiveRecord::ConnectionAdapters::ColumnDumper#prepare_column_options` no
|
2115
|
+
longer have a `types` argument. They should access
|
2116
|
+
`connection#native_database_types` directly.
|
2030
2117
|
|
2031
2118
|
*Yves Senn*
|
2032
2119
|
|
2033
|
-
Please check [4-
|
2120
|
+
Please check [4-2-stable](https://github.com/rails/rails/blob/4-2-stable/activerecord/CHANGELOG.md) for previous changes.
|