activerecord 4.1.0 → 4.2.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 +4 -4
- data/CHANGELOG.md +776 -1330
- data/README.rdoc +15 -10
- data/lib/active_record/aggregations.rb +12 -8
- data/lib/active_record/association_relation.rb +4 -0
- data/lib/active_record/associations/alias_tracker.rb +14 -13
- data/lib/active_record/associations/association.rb +2 -2
- data/lib/active_record/associations/association_scope.rb +83 -43
- data/lib/active_record/associations/belongs_to_association.rb +15 -5
- data/lib/active_record/associations/builder/association.rb +15 -4
- data/lib/active_record/associations/builder/belongs_to.rb +7 -29
- data/lib/active_record/associations/builder/has_and_belongs_to_many.rb +9 -6
- data/lib/active_record/associations/builder/has_many.rb +1 -1
- data/lib/active_record/associations/builder/has_one.rb +2 -2
- data/lib/active_record/associations/builder/singular_association.rb +8 -1
- data/lib/active_record/associations/collection_association.rb +66 -29
- data/lib/active_record/associations/collection_proxy.rb +22 -26
- data/lib/active_record/associations/has_many_association.rb +65 -18
- data/lib/active_record/associations/has_many_through_association.rb +55 -27
- data/lib/active_record/associations/has_one_association.rb +0 -1
- data/lib/active_record/associations/join_dependency/join_association.rb +19 -15
- data/lib/active_record/associations/join_dependency/join_part.rb +0 -1
- data/lib/active_record/associations/join_dependency.rb +20 -12
- data/lib/active_record/associations/preloader/association.rb +34 -11
- data/lib/active_record/associations/preloader/through_association.rb +4 -3
- data/lib/active_record/associations/preloader.rb +49 -59
- data/lib/active_record/associations/singular_association.rb +25 -4
- data/lib/active_record/associations/through_association.rb +23 -14
- data/lib/active_record/associations.rb +171 -42
- data/lib/active_record/attribute.rb +149 -0
- data/lib/active_record/attribute_assignment.rb +18 -10
- data/lib/active_record/attribute_decorators.rb +66 -0
- data/lib/active_record/attribute_methods/before_type_cast.rb +2 -2
- data/lib/active_record/attribute_methods/dirty.rb +98 -44
- data/lib/active_record/attribute_methods/primary_key.rb +14 -8
- data/lib/active_record/attribute_methods/query.rb +1 -1
- data/lib/active_record/attribute_methods/read.rb +22 -59
- data/lib/active_record/attribute_methods/serialization.rb +37 -147
- data/lib/active_record/attribute_methods/time_zone_conversion.rb +34 -28
- data/lib/active_record/attribute_methods/write.rb +14 -21
- data/lib/active_record/attribute_methods.rb +67 -94
- data/lib/active_record/attribute_set/builder.rb +86 -0
- data/lib/active_record/attribute_set.rb +77 -0
- data/lib/active_record/attributes.rb +139 -0
- data/lib/active_record/autosave_association.rb +45 -38
- data/lib/active_record/base.rb +10 -20
- data/lib/active_record/callbacks.rb +7 -7
- data/lib/active_record/coders/json.rb +13 -0
- data/lib/active_record/connection_adapters/abstract/connection_pool.rb +78 -52
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +38 -59
- data/lib/active_record/connection_adapters/abstract/query_cache.rb +1 -0
- data/lib/active_record/connection_adapters/abstract/quoting.rb +59 -55
- data/lib/active_record/connection_adapters/abstract/schema_creation.rb +46 -5
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +126 -54
- data/lib/active_record/connection_adapters/abstract/schema_dumper.rb +14 -34
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +198 -64
- data/lib/active_record/connection_adapters/abstract/transaction.rb +126 -114
- data/lib/active_record/connection_adapters/abstract_adapter.rb +154 -55
- data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +240 -135
- data/lib/active_record/connection_adapters/column.rb +28 -239
- data/lib/active_record/connection_adapters/connection_specification.rb +16 -25
- data/lib/active_record/connection_adapters/mysql2_adapter.rb +20 -22
- data/lib/active_record/connection_adapters/mysql_adapter.rb +65 -149
- data/lib/active_record/connection_adapters/postgresql/array_parser.rb +15 -27
- data/lib/active_record/connection_adapters/postgresql/column.rb +20 -0
- data/lib/active_record/connection_adapters/postgresql/database_statements.rb +39 -27
- data/lib/active_record/connection_adapters/postgresql/oid/array.rb +99 -0
- data/lib/active_record/connection_adapters/postgresql/oid/bit.rb +52 -0
- data/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb +13 -0
- data/lib/active_record/connection_adapters/postgresql/oid/bytea.rb +14 -0
- data/lib/active_record/connection_adapters/postgresql/oid/cidr.rb +46 -0
- data/lib/active_record/connection_adapters/postgresql/oid/date.rb +11 -0
- data/lib/active_record/connection_adapters/postgresql/oid/date_time.rb +27 -0
- data/lib/active_record/connection_adapters/postgresql/oid/decimal.rb +13 -0
- data/lib/active_record/connection_adapters/postgresql/oid/enum.rb +17 -0
- data/lib/active_record/connection_adapters/postgresql/oid/float.rb +21 -0
- data/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +59 -0
- data/lib/active_record/connection_adapters/postgresql/oid/inet.rb +13 -0
- data/lib/active_record/connection_adapters/postgresql/oid/infinity.rb +13 -0
- data/lib/active_record/connection_adapters/postgresql/oid/integer.rb +11 -0
- data/lib/active_record/connection_adapters/postgresql/oid/json.rb +35 -0
- data/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb +23 -0
- data/lib/active_record/connection_adapters/postgresql/oid/money.rb +43 -0
- data/lib/active_record/connection_adapters/postgresql/oid/point.rb +43 -0
- data/lib/active_record/connection_adapters/postgresql/oid/range.rb +79 -0
- data/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb +15 -0
- data/lib/active_record/connection_adapters/postgresql/oid/time.rb +11 -0
- data/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb +97 -0
- data/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +21 -0
- data/lib/active_record/connection_adapters/postgresql/oid/vector.rb +26 -0
- data/lib/active_record/connection_adapters/postgresql/oid/xml.rb +28 -0
- data/lib/active_record/connection_adapters/postgresql/oid.rb +29 -374
- data/lib/active_record/connection_adapters/postgresql/quoting.rb +55 -135
- data/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +4 -4
- data/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +152 -0
- data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +127 -38
- data/lib/active_record/connection_adapters/postgresql/utils.rb +77 -0
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +220 -466
- data/lib/active_record/connection_adapters/schema_cache.rb +14 -28
- data/lib/active_record/connection_adapters/sqlite3_adapter.rb +66 -61
- data/lib/active_record/connection_handling.rb +3 -3
- data/lib/active_record/core.rb +143 -32
- data/lib/active_record/counter_cache.rb +60 -7
- data/lib/active_record/enum.rb +10 -11
- data/lib/active_record/errors.rb +49 -27
- data/lib/active_record/explain.rb +1 -1
- data/lib/active_record/fixtures.rb +56 -70
- data/lib/active_record/gem_version.rb +2 -2
- data/lib/active_record/inheritance.rb +35 -10
- data/lib/active_record/integration.rb +4 -4
- data/lib/active_record/locking/optimistic.rb +35 -17
- data/lib/active_record/log_subscriber.rb +1 -1
- data/lib/active_record/migration/command_recorder.rb +19 -2
- data/lib/active_record/migration/join_table.rb +1 -1
- data/lib/active_record/migration.rb +52 -49
- data/lib/active_record/model_schema.rb +49 -57
- data/lib/active_record/nested_attributes.rb +7 -7
- data/lib/active_record/null_relation.rb +19 -5
- data/lib/active_record/persistence.rb +50 -31
- data/lib/active_record/query_cache.rb +3 -3
- data/lib/active_record/querying.rb +10 -7
- data/lib/active_record/railtie.rb +14 -11
- data/lib/active_record/railties/databases.rake +56 -54
- data/lib/active_record/readonly_attributes.rb +0 -1
- data/lib/active_record/reflection.rb +286 -102
- data/lib/active_record/relation/batches.rb +0 -1
- data/lib/active_record/relation/calculations.rb +39 -31
- data/lib/active_record/relation/delegation.rb +2 -2
- data/lib/active_record/relation/finder_methods.rb +80 -36
- data/lib/active_record/relation/merger.rb +25 -30
- data/lib/active_record/relation/predicate_builder/array_handler.rb +31 -13
- data/lib/active_record/relation/predicate_builder/relation_handler.rb +1 -1
- data/lib/active_record/relation/predicate_builder.rb +11 -10
- data/lib/active_record/relation/query_methods.rb +141 -55
- data/lib/active_record/relation/spawn_methods.rb +3 -0
- data/lib/active_record/relation.rb +69 -30
- data/lib/active_record/result.rb +18 -7
- data/lib/active_record/sanitization.rb +12 -2
- data/lib/active_record/schema.rb +0 -1
- data/lib/active_record/schema_dumper.rb +58 -26
- data/lib/active_record/schema_migration.rb +11 -0
- data/lib/active_record/scoping/default.rb +8 -7
- data/lib/active_record/scoping/named.rb +4 -0
- data/lib/active_record/serializers/xml_serializer.rb +3 -7
- data/lib/active_record/statement_cache.rb +95 -10
- data/lib/active_record/store.rb +19 -10
- data/lib/active_record/tasks/database_tasks.rb +73 -7
- data/lib/active_record/tasks/mysql_database_tasks.rb +3 -2
- data/lib/active_record/tasks/postgresql_database_tasks.rb +1 -1
- data/lib/active_record/tasks/sqlite_database_tasks.rb +5 -1
- data/lib/active_record/timestamp.rb +11 -9
- data/lib/active_record/transactions.rb +37 -21
- data/lib/active_record/type/big_integer.rb +13 -0
- data/lib/active_record/type/binary.rb +50 -0
- data/lib/active_record/type/boolean.rb +30 -0
- data/lib/active_record/type/date.rb +46 -0
- data/lib/active_record/type/date_time.rb +43 -0
- data/lib/active_record/type/decimal.rb +40 -0
- data/lib/active_record/type/decimal_without_scale.rb +11 -0
- data/lib/active_record/type/decorator.rb +14 -0
- data/lib/active_record/type/float.rb +19 -0
- data/lib/active_record/type/hash_lookup_type_map.rb +17 -0
- data/lib/active_record/type/integer.rb +55 -0
- data/lib/active_record/type/mutable.rb +16 -0
- data/lib/active_record/type/numeric.rb +36 -0
- data/lib/active_record/type/serialized.rb +56 -0
- data/lib/active_record/type/string.rb +36 -0
- data/lib/active_record/type/text.rb +11 -0
- data/lib/active_record/type/time.rb +26 -0
- data/lib/active_record/type/time_value.rb +38 -0
- data/lib/active_record/type/type_map.rb +64 -0
- data/lib/active_record/type/unsigned_integer.rb +15 -0
- data/lib/active_record/type/value.rb +101 -0
- data/lib/active_record/type.rb +23 -0
- data/lib/active_record/validations/associated.rb +5 -3
- data/lib/active_record/validations/presence.rb +6 -4
- data/lib/active_record/validations/uniqueness.rb +11 -17
- data/lib/active_record/validations.rb +25 -19
- data/lib/active_record.rb +3 -0
- data/lib/rails/generators/active_record/migration/migration_generator.rb +8 -4
- data/lib/rails/generators/active_record/migration/templates/create_table_migration.rb +4 -1
- data/lib/rails/generators/active_record/migration/templates/migration.rb +6 -0
- data/lib/rails/generators/active_record/model/templates/model.rb +1 -1
- metadata +65 -10
- data/lib/active_record/connection_adapters/postgresql/cast.rb +0 -168
data/CHANGELOG.md
CHANGED
@@ -1,1926 +1,1372 @@
|
|
1
|
-
*
|
2
|
-
|
1
|
+
* Introduce `force: :cascade` option for `create_table`. Using this option
|
2
|
+
will recreate tables even if they have dependent objects (like foreign keys).
|
3
|
+
`db/schema.rb` now uses `force: :cascade`. This makes it possible to
|
4
|
+
reload the schema when foreign keys are in place.
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
-
*Evan Whalen*
|
7
|
-
|
8
|
-
* Block a few default Class methods as scope name.
|
9
|
-
|
10
|
-
For instance, this will raise:
|
11
|
-
|
12
|
-
scope :public, -> { where(status: 1) }
|
13
|
-
|
14
|
-
*arthurnn*
|
15
|
-
|
16
|
-
* Deprecate SQLite database URLs containing an
|
17
|
-
authority.
|
18
|
-
|
19
|
-
The current "correct" spellings for in-memory, relative, and
|
20
|
-
absolute URLs, respectively, are:
|
6
|
+
*Matthew Draper*, *Yves Senn*
|
21
7
|
|
22
|
-
|
23
|
-
|
24
|
-
|
8
|
+
* `db:schema:load` and `db:structure:load` no longer purge the database
|
9
|
+
before loading the schema. This is left for the user to do.
|
10
|
+
`db:test:prepare` will still purge the database.
|
25
11
|
|
26
|
-
|
27
|
-
as it did in Rails 4.0, but with a deprecation warning: in the next
|
28
|
-
release, that spelling will instead be interpreted as an absolute
|
29
|
-
path.
|
30
|
-
|
31
|
-
*Matthew Draper*
|
32
|
-
|
33
|
-
* `where.not` adds `references` for `includes` like normal `where` calls do.
|
34
|
-
|
35
|
-
Fixes #14406.
|
12
|
+
Closes #17945.
|
36
13
|
|
37
14
|
*Yves Senn*
|
38
15
|
|
39
|
-
*
|
40
|
-
joins are involved.
|
41
|
-
|
42
|
-
Fixes #14109.
|
43
|
-
|
44
|
-
*Aaron Patterson*, *Yves Senn*
|
45
|
-
|
46
|
-
* Fixed error with validation with enum fields for records where the
|
47
|
-
value for any enum attribute is always evaluated as 0 during
|
48
|
-
uniqueness validation.
|
49
|
-
|
50
|
-
Fixes #14172.
|
51
|
-
|
52
|
-
*Vilius Luneckas* *Ahmed AbouElhamayed*
|
53
|
-
|
54
|
-
* `before_add` callbacks are fired before the record is saved on
|
55
|
-
`has_and_belongs_to_many` assocations *and* on `has_many :through`
|
56
|
-
associations. Before this change, `before_add` callbacks would be fired
|
57
|
-
before the record was saved on `has_and_belongs_to_many` associations, but
|
58
|
-
*not* on `has_many :through` associations.
|
59
|
-
|
60
|
-
Fixes #14144.
|
61
|
-
|
62
|
-
* Fixed STI classes not defining an attribute method if there is a
|
63
|
-
conflicting private method defined on its ancestors.
|
64
|
-
|
65
|
-
Fixes #11569.
|
66
|
-
|
67
|
-
*Godfrey Chan*
|
68
|
-
|
69
|
-
* Default scopes are no longer overriden by chained conditions.
|
70
|
-
|
71
|
-
Before this change when you defined a `default_scope` in a model
|
72
|
-
it was overriden by chained conditions in the same field. Now it
|
73
|
-
is merged like any other scope.
|
74
|
-
|
75
|
-
Before:
|
76
|
-
|
77
|
-
class User < ActiveRecord::Base
|
78
|
-
default_scope { where state: 'pending' }
|
79
|
-
scope :active, -> { where state: 'active' }
|
80
|
-
scope :inactive, -> { where state: 'inactive' }
|
81
|
-
end
|
82
|
-
|
83
|
-
User.all
|
84
|
-
# SELECT "users".* FROM "users" WHERE "users"."state" = 'pending'
|
85
|
-
|
86
|
-
User.active
|
87
|
-
# SELECT "users".* FROM "users" WHERE "users"."state" = 'active'
|
88
|
-
|
89
|
-
User.where(state: 'inactive')
|
90
|
-
# SELECT "users".* FROM "users" WHERE "users"."state" = 'inactive'
|
16
|
+
* Fix undesirable RangeError by Type::Integer. Add Type::UnsignedInteger.
|
91
17
|
|
92
|
-
|
93
|
-
|
94
|
-
class User < ActiveRecord::Base
|
95
|
-
default_scope { where state: 'pending' }
|
96
|
-
scope :active, -> { where state: 'active' }
|
97
|
-
scope :inactive, -> { where state: 'inactive' }
|
98
|
-
end
|
99
|
-
|
100
|
-
User.all
|
101
|
-
# SELECT "users".* FROM "users" WHERE "users"."state" = 'pending'
|
102
|
-
|
103
|
-
User.active
|
104
|
-
# SELECT "users".* FROM "users" WHERE "users"."state" = 'pending' AND "users"."state" = 'active'
|
105
|
-
|
106
|
-
User.where(state: 'inactive')
|
107
|
-
# SELECT "users".* FROM "users" WHERE "users"."state" = 'pending' AND "users"."state" = 'inactive'
|
108
|
-
|
109
|
-
To get the previous behavior it is needed to explicitly remove the
|
110
|
-
`default_scope` condition using `unscoped`, `unscope`, `rewhere` or
|
111
|
-
`except`.
|
112
|
-
|
113
|
-
Example:
|
114
|
-
|
115
|
-
class User < ActiveRecord::Base
|
116
|
-
default_scope { where state: 'pending' }
|
117
|
-
scope :active, -> { unscope(where: :state).where(state: 'active') }
|
118
|
-
scope :inactive, -> { rewhere state: 'inactive' }
|
119
|
-
end
|
120
|
-
|
121
|
-
User.all
|
122
|
-
# SELECT "users".* FROM "users" WHERE "users"."state" = 'pending'
|
123
|
-
|
124
|
-
User.active
|
125
|
-
# SELECT "users".* FROM "users" WHERE "users"."state" = 'active'
|
18
|
+
*Ryuta Kamizono*
|
126
19
|
|
127
|
-
|
128
|
-
# SELECT "users".* FROM "users" WHERE "users"."state" = 'inactive'
|
20
|
+
* Add `foreign_type` option to `has_one` and `has_many` association macros.
|
129
21
|
|
130
|
-
|
22
|
+
This option enables to define the column name of associated object's type for polymorphic associations.
|
131
23
|
|
132
|
-
|
24
|
+
*Ulisses Almeida, Kassio Borges*
|
133
25
|
|
134
|
-
|
26
|
+
* `add_timestamps` and `remove_timestamps` now properly reversible with
|
27
|
+
options.
|
135
28
|
|
136
|
-
*
|
137
|
-
in multi-threaded environments.
|
29
|
+
*Noam Gagliardi-Rabinovich*
|
138
30
|
|
139
|
-
|
31
|
+
* Bring back `db:test:prepare` to synchronize the test database schema.
|
140
32
|
|
141
|
-
|
33
|
+
Manual synchronization using `bin/rake db:test:prepare` is required
|
34
|
+
when a migration is rolled-back, edited and reapplied.
|
142
35
|
|
143
|
-
|
144
|
-
the
|
36
|
+
`ActiveRecord::Base.maintain_test_schema` now uses `db:test:prepare`
|
37
|
+
to synchronize the schema. Plugins can use this task as a hook to
|
38
|
+
provide custom behavior after the schema has been loaded.
|
145
39
|
|
146
|
-
|
147
|
-
explicitly named then reverting the migration adding the named one
|
148
|
-
would instead drop the unnamed one.
|
40
|
+
NOTE: `test:prepare` runs before the schema is synchronized.
|
149
41
|
|
150
|
-
|
151
|
-
it is present.
|
42
|
+
Fixes #17171, #15787.
|
152
43
|
|
153
|
-
*
|
154
|
-
|
155
|
-
* Add flag to disable schema dump after migration.
|
156
|
-
|
157
|
-
Add a config parameter on Active Record named `dump_schema_after_migration`
|
158
|
-
which is true by default. Now schema dump does not happen at the
|
159
|
-
end of migration rake task if `dump_schema_after_migration` is false.
|
160
|
-
|
161
|
-
*Emil Soman*
|
162
|
-
|
163
|
-
* `find_in_batches`, `find_each`, `Result#each` and `Enumerable#index_by` now
|
164
|
-
return an `Enumerator` that can calculate its size.
|
44
|
+
*Yves Senn*
|
165
45
|
|
166
|
-
|
46
|
+
* Change `reflections` public api to return the keys as String objects.
|
167
47
|
|
168
|
-
|
48
|
+
Fixes #16928.
|
169
49
|
|
170
|
-
*
|
50
|
+
*arthurnn*
|
171
51
|
|
172
|
-
|
173
|
-
of the transaction level state, and it was leaking that state.
|
52
|
+
* Renaming a table in pg also renames the primary key index.
|
174
53
|
|
175
|
-
Fixes #
|
54
|
+
Fixes #12856
|
176
55
|
|
177
|
-
*
|
56
|
+
*Sean Griffin*
|
178
57
|
|
179
|
-
*
|
180
|
-
the underlying `has_many :through` association.
|
181
|
-
|
182
|
-
Fixes #13923.
|
58
|
+
* Make it possible to access fixtures excluded by a `default_scope`.
|
183
59
|
|
184
60
|
*Yves Senn*
|
185
61
|
|
186
|
-
*
|
62
|
+
* Fix preloading of associations with a scope containing joins along with
|
63
|
+
conditions on the joined association.
|
187
64
|
|
188
|
-
|
189
|
-
not supported by the ActiveRecord schema dumper. For example, expressions
|
190
|
-
indexes would not be detected.
|
65
|
+
*Siddharth Sharma*
|
191
66
|
|
192
|
-
|
67
|
+
* Add `Table#name` to match `TableDefinition#name`.
|
193
68
|
|
194
|
-
*
|
69
|
+
*Cody Cutrer*
|
195
70
|
|
196
|
-
*
|
71
|
+
* Cache `CollectionAssociation#reader` proxies separately before and after
|
72
|
+
the owner has been saved so that the proxy is not cached without the
|
73
|
+
owner's id.
|
197
74
|
|
198
|
-
|
199
|
-
would be `["1","2","3"]`, removing the empty strings from the array,
|
200
|
-
which would be incorrect. Now it will correctly produce `["1","","2","","3"]`
|
201
|
-
as the result of parsing the above PostgreSQL array.
|
75
|
+
*Ben Woosley*
|
202
76
|
|
203
|
-
|
77
|
+
* `ActiveRecord::ReadOnlyRecord` now has a descriptive message.
|
204
78
|
|
205
|
-
*
|
79
|
+
*Franky W.*
|
206
80
|
|
207
|
-
*
|
81
|
+
* Fix preloading of associations which unscope a default scope.
|
208
82
|
|
209
|
-
|
210
|
-
defined by `ActiveRecord::Base`.
|
83
|
+
Fixes #11036.
|
211
84
|
|
212
|
-
|
85
|
+
*Byron Bischoff*
|
213
86
|
|
214
|
-
|
215
|
-
has_many :errors
|
216
|
-
end
|
217
|
-
# Will raise ArgumentError.
|
87
|
+
* Added SchemaDumper support for tables with jsonb columns.
|
218
88
|
|
219
|
-
|
89
|
+
*Ted O'Meara*
|
220
90
|
|
221
|
-
|
91
|
+
* Deprecate `sanitize_sql_hash_for_conditions` without replacement. Using a
|
92
|
+
`Relation` for performing queries and updates is the prefered API.
|
222
93
|
|
223
|
-
*
|
224
|
-
When `select_*` methods receive a `Relation` object, they should be able to
|
225
|
-
get the arel/binds from it.
|
226
|
-
Also fix regressions on `select_rows` that was ignoring the binds.
|
94
|
+
*Sean Griffin*
|
227
95
|
|
228
|
-
|
96
|
+
* Queries now properly type cast values that are part of a join statement,
|
97
|
+
even when using type decorators such as `serialize`.
|
229
98
|
|
230
|
-
*
|
99
|
+
*Melanie Gilman & Sean Griffin*
|
231
100
|
|
232
|
-
*
|
233
|
-
|
101
|
+
* MySQL enum type lookups, with values matching another type, no longer result
|
102
|
+
in an endless loop.
|
234
103
|
|
235
|
-
|
236
|
-
in an Active Record model that used serialization it would fail at the last
|
237
|
-
dump due to the fields not being correctly serialized before being dumped
|
238
|
-
to YAML. Now it is possible to dump and load the same object as many times
|
239
|
-
as needed without any issues.
|
104
|
+
Fixes #17402.
|
240
105
|
|
241
|
-
|
106
|
+
*Yves Senn*
|
242
107
|
|
243
|
-
|
108
|
+
* Raise `ArgumentError` when the body of a scope is not callable.
|
244
109
|
|
245
|
-
*
|
246
|
-
can be chained with other `Enumerable` methods.
|
110
|
+
*Mauro George*
|
247
111
|
|
248
|
-
|
112
|
+
* Use type column first in multi-column indexes created with `add-reference`.
|
249
113
|
|
250
|
-
*
|
114
|
+
*Derek Prior*
|
251
115
|
|
252
|
-
|
253
|
-
with methods defined within `ActiveRecord::Base` but not its ancestors,
|
254
|
-
as well as conflicts with methods generated by other enums on the same
|
255
|
-
class.
|
116
|
+
* Fix `Relation.rewhere` to work with Range values.
|
256
117
|
|
257
|
-
|
118
|
+
*Dan Olson*
|
258
119
|
|
259
|
-
|
120
|
+
* `AR::UnknownAttributeError` now includes the class name of a record.
|
260
121
|
|
261
|
-
|
122
|
+
User.new(name: "Yuki Nishijima", project_attributes: {name: "kaminari"})
|
123
|
+
# => ActiveRecord::UnknownAttributeError: unknown attribute 'name' for User.
|
262
124
|
|
263
|
-
|
264
|
-
dangerous if it conflicts with an existing class method defined within
|
265
|
-
`ActiveRecord::Base` but not its ancestors.
|
125
|
+
*Yuki Nishijima*
|
266
126
|
|
267
|
-
|
127
|
+
* Fix a regression causing `after_create` callbacks to run before associated
|
128
|
+
records are autosaved.
|
268
129
|
|
269
|
-
|
130
|
+
Fixes #17209.
|
270
131
|
|
271
|
-
*
|
132
|
+
*Agis Anastasopoulos*
|
272
133
|
|
273
|
-
|
274
|
-
|
275
|
-
# After: SELECT * ... LIMIT 1 FOR SHARE NOWAIT
|
134
|
+
* Honor overridden `rack.test` in Rack environment for the connection
|
135
|
+
management middleware.
|
276
136
|
|
277
|
-
|
137
|
+
*Simon Eskildsen*
|
278
138
|
|
279
|
-
|
139
|
+
* Add a truncate method to the connection.
|
280
140
|
|
281
|
-
*
|
141
|
+
*Aaron Patterson*
|
282
142
|
|
283
|
-
|
143
|
+
* Don't autosave unchanged has_one through records.
|
284
144
|
|
285
|
-
*
|
145
|
+
*Alan Kennedy*, *Steve Parrington*
|
286
146
|
|
287
|
-
|
147
|
+
* Do not dump foreign keys for ignored tables.
|
288
148
|
|
289
|
-
|
290
|
-
post.comments.reset
|
291
|
-
post.comments.loaded? # => true
|
149
|
+
*Yves Senn*
|
292
150
|
|
293
|
-
|
151
|
+
* PostgreSQL adapter correctly dumps foreign keys targeting tables
|
152
|
+
outside the schema search path.
|
294
153
|
|
295
|
-
|
296
|
-
post.comments.reset
|
297
|
-
post.comments.loaded? # => false
|
154
|
+
Fixes #16907.
|
298
155
|
|
299
|
-
|
156
|
+
*Matthew Draper*, *Yves Senn*
|
300
157
|
|
301
|
-
|
158
|
+
* When a thread is killed, rollback the active transaction, instead of
|
159
|
+
committing it during the stack unwind. Previously, we could commit half-
|
160
|
+
completed work. This fix only works for Ruby 2.0+; on 1.9, we can't
|
161
|
+
distinguish a thread kill from an ordinary non-local (block) return, so must
|
162
|
+
default to committing.
|
302
163
|
|
303
|
-
*
|
164
|
+
*Chris Hanks*
|
304
165
|
|
305
|
-
|
166
|
+
* A `NullRelation` should represent nothing. This fixes a bug where
|
167
|
+
`Comment.where(post_id: Post.none)` returned a non-empty result.
|
306
168
|
|
307
|
-
|
308
|
-
conversation.status = :active
|
309
|
-
conversation.status = :archived
|
310
|
-
conversation.status_was # => 0
|
169
|
+
Fixes #15176.
|
311
170
|
|
312
|
-
|
171
|
+
*Matthew Draper*, *Yves Senn*
|
313
172
|
|
314
|
-
|
315
|
-
|
316
|
-
conversation.status = :archived
|
317
|
-
conversation.status_was # => "active"
|
173
|
+
* Include default column limits in schema.rb. Allows defaults to be changed
|
174
|
+
in the future without affecting old migrations that assumed old defaults.
|
318
175
|
|
319
|
-
*
|
176
|
+
*Jeremy Kemper*
|
320
177
|
|
321
|
-
*
|
322
|
-
anymore.
|
178
|
+
* MySQL: schema.rb now includes TEXT and BLOB column limits.
|
323
179
|
|
324
|
-
|
325
|
-
consistent results among different database engines. But for singular
|
326
|
-
associations this behavior is not needed since we will have one record to
|
327
|
-
return. As this ORDER BY option can lead some performance issues we are
|
328
|
-
removing it for singular associations accessors.
|
180
|
+
*Jeremy Kemper*
|
329
181
|
|
330
|
-
|
182
|
+
* MySQL: correct LONGTEXT and LONGBLOB limits from 2GB to their true 4GB.
|
331
183
|
|
332
|
-
*
|
184
|
+
*Jeremy Kemper*
|
333
185
|
|
334
|
-
*
|
186
|
+
* SQLite3Adapter now checks for views in `table_exists?`. Fixes #14041.
|
335
187
|
|
336
|
-
|
188
|
+
*Girish Sonawane*
|
337
189
|
|
338
|
-
|
339
|
-
|
340
|
-
# After: => SELECT "posts"."id" FROM "posts"
|
190
|
+
* Introduce `connection.supports_views?` to check whether the current adapter
|
191
|
+
has support for SQL views. Connection adapters should define this method.
|
341
192
|
|
342
193
|
*Yves Senn*
|
343
194
|
|
344
|
-
*
|
345
|
-
in `find_in_batches`.
|
346
|
-
|
347
|
-
Before this patch, the exception was raised after the first batch was
|
348
|
-
yielded to the block. This means that you only get it, when you hit the
|
349
|
-
`batch_size` treshold. This could shadow the issue in development.
|
350
|
-
|
351
|
-
*Alexander Balashov*
|
195
|
+
* Allow included modules to override association methods.
|
352
196
|
|
353
|
-
|
197
|
+
Fixes #16684.
|
354
198
|
|
355
|
-
|
356
|
-
(`first`, `second`, `third`, `fourth`, and `fifth`) are now available as
|
357
|
-
full-fledged finders in ActiveRecord. The biggest benefit of this is ordering
|
358
|
-
of the records returned now defaults to the table's primary key in ascending order.
|
359
|
-
|
360
|
-
Fixes #13743.
|
199
|
+
*Yves Senn*
|
361
200
|
|
362
|
-
|
201
|
+
* Schema loading rake tasks (like `db:schema:load` and `db:setup`) maintain
|
202
|
+
the database connection to the current environment.
|
363
203
|
|
364
|
-
|
204
|
+
Fixes #16757.
|
365
205
|
|
366
|
-
|
367
|
-
# => 'SELECT "users".* FROM "users"'
|
206
|
+
*Joshua Cody*, *Yves Senn*
|
368
207
|
|
369
|
-
|
370
|
-
# => SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1 OFFSET 1'
|
208
|
+
* MySQL: set the connection collation along with the charset.
|
371
209
|
|
372
|
-
|
210
|
+
Sets the connection collation to the database collation configured in
|
211
|
+
database.yml. Otherwise, `SET NAMES utf8mb4` will use the default
|
212
|
+
collation for that charset (utf8mb4_general_ci) when you may have chosen
|
213
|
+
a different collation, like utf8mb4_unicode_ci.
|
373
214
|
|
374
|
-
|
375
|
-
|
376
|
-
# => 'SELECT "users".* FROM "users" OFFSET 3' # pg gem
|
377
|
-
# => 'SELECT `users`.* FROM `users` LIMIT 18446744073709551615 OFFSET 3' # mysql2 gem
|
215
|
+
This only applies to literal string comparisons, not column values, so it
|
216
|
+
is unlikely to affect you.
|
378
217
|
|
379
|
-
|
380
|
-
# => SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1 OFFSET 4'
|
218
|
+
*Jeremy Kemper*
|
381
219
|
|
382
|
-
|
220
|
+
* `default_sequence_name` from the PostgreSQL adapter returns a `String`.
|
383
221
|
|
384
|
-
*
|
385
|
-
models that did not define any transactional callbacks (i.e.
|
386
|
-
`after_commit`, `after_rollback` or `after_create`).
|
222
|
+
*Yves Senn*
|
387
223
|
|
388
|
-
|
224
|
+
* Fix a regression where whitespaces were stripped from DISTINCT queries in
|
225
|
+
PostgreSQL.
|
389
226
|
|
390
|
-
*
|
227
|
+
*Agis Anastasopoulos*
|
391
228
|
|
392
|
-
|
229
|
+
Fixes #16623.
|
393
230
|
|
394
|
-
|
231
|
+
* Fix has_many :through relation merging failing when dynamic conditions are
|
232
|
+
passed as a lambda with an arity of one.
|
395
233
|
|
396
|
-
|
234
|
+
Fixes #16128.
|
397
235
|
|
398
|
-
|
236
|
+
*Agis Anastasopoulos*
|
399
237
|
|
400
|
-
|
238
|
+
* Fix `Relation#exists?` to work with polymorphic associations.
|
401
239
|
|
402
|
-
|
240
|
+
Fixes #15821.
|
403
241
|
|
404
|
-
|
405
|
-
the `inheritance_column` setting doesn't exist. This prevents setting associations
|
406
|
-
via the attributes hash if the association name clashes with the value of the setting,
|
407
|
-
typically `:type`. This worked previously in Rails 3.2.
|
242
|
+
*Kassio Borges*
|
408
243
|
|
409
|
-
|
244
|
+
* Currently, Active Record rescues any errors raised within
|
245
|
+
`after_rollback`/`after_create` callbacks and prints them to the logs.
|
246
|
+
Future versions of Rails will not rescue these errors anymore and
|
247
|
+
just bubble them up like the other callbacks.
|
410
248
|
|
411
|
-
|
249
|
+
This commit adds an opt-in flag to enable not rescuing the errors.
|
412
250
|
|
413
251
|
Example:
|
414
252
|
|
415
|
-
|
416
|
-
|
417
|
-
end
|
253
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
254
|
+
config.active_record.raise_in_transactional_callbacks = true
|
418
255
|
|
419
|
-
|
256
|
+
Fixes #13460.
|
420
257
|
|
421
|
-
|
258
|
+
*arthurnn*
|
422
259
|
|
423
|
-
|
260
|
+
* Fix an issue where custom accessor methods (such as those generated by
|
261
|
+
`enum`) with the same name as a global method are incorrectly overridden
|
262
|
+
when subclassing.
|
424
263
|
|
425
|
-
|
264
|
+
Fixes #16288.
|
426
265
|
|
427
266
|
*Godfrey Chan*
|
428
267
|
|
429
|
-
*
|
430
|
-
|
431
|
-
*Chulki Lee*
|
268
|
+
* `*_was` and `changes` now work correctly for in-place attribute changes as
|
269
|
+
well.
|
432
270
|
|
433
|
-
*
|
271
|
+
*Sean Griffin*
|
434
272
|
|
435
|
-
|
273
|
+
* Fix regression on `after_commit` that did not fire with nested transactions.
|
436
274
|
|
437
|
-
|
275
|
+
Fixes #16425.
|
438
276
|
|
439
|
-
*
|
440
|
-
`DATABASE_URL` or by manually injecting a hash of values which is what Rails does,
|
441
|
-
reading in `database.yml` and setting Active Record appropriately. Active Record
|
442
|
-
expects to be able to use `DATABASE_URL` without the use of Rails, and we cannot
|
443
|
-
rip out this functionality without deprecating. This presents a problem though
|
444
|
-
when both config is set, and a `DATABASE_URL` is present. Currently the
|
445
|
-
`DATABASE_URL` should "win" and none of the values in `database.yml` are
|
446
|
-
used. This is somewhat unexpected, if one were to set values such as
|
447
|
-
`pool` in the `production:` group of `database.yml` they are ignored.
|
448
|
-
|
449
|
-
There are many ways that Active Record initiates a connection today:
|
450
|
-
|
451
|
-
- Stand Alone (without rails)
|
452
|
-
- `rake db:<tasks>`
|
453
|
-
- `ActiveRecord.establish_connection`
|
454
|
-
|
455
|
-
- With Rails
|
456
|
-
- `rake db:<tasks>`
|
457
|
-
- `rails <server> | <console>`
|
458
|
-
- `rails dbconsole`
|
459
|
-
|
460
|
-
Now all of these behave exactly the same way. The best way to do
|
461
|
-
this is to put all of this logic in one place so it is guaranteed to be used.
|
462
|
-
|
463
|
-
Here is the matrix of how this behavior works:
|
464
|
-
|
465
|
-
```
|
466
|
-
No database.yml
|
467
|
-
No DATABASE_URL
|
468
|
-
=> Error
|
469
|
-
```
|
470
|
-
|
471
|
-
```
|
472
|
-
database.yml present
|
473
|
-
No DATABASE_URL
|
474
|
-
=> Use database.yml configuration
|
475
|
-
```
|
476
|
-
|
477
|
-
```
|
478
|
-
No database.yml
|
479
|
-
DATABASE_URL present
|
480
|
-
=> use DATABASE_URL configuration
|
481
|
-
```
|
482
|
-
|
483
|
-
```
|
484
|
-
database.yml present
|
485
|
-
DATABASE_URL present
|
486
|
-
=> Merged into `url` sub key. If both specify `url` sub key, the `database.yml` `url`
|
487
|
-
sub key "wins". If other paramaters `adapter` or `database` are specified in YAML,
|
488
|
-
they are discarded as the `url` sub key "wins".
|
489
|
-
```
|
277
|
+
*arthurnn*
|
490
278
|
|
491
|
-
|
492
|
-
all connection information before returning. This is achieved through a utility
|
493
|
-
class: `ActiveRecord::ConnectionHandling::MergeAndResolveDefaultUrlConfig`.
|
279
|
+
* Do not try to write timestamps when a table has no timestamps columns.
|
494
280
|
|
495
|
-
|
496
|
-
behavior in `activerecord/test/cases/connection_adapters/connection_handler_test.rb`.
|
281
|
+
Fixes #8813.
|
497
282
|
|
498
|
-
*
|
283
|
+
*Sergey Potapov*
|
499
284
|
|
500
|
-
*
|
285
|
+
* `index_exists?` with `:name` option does verify specified columns.
|
501
286
|
|
502
|
-
|
287
|
+
Example:
|
503
288
|
|
504
|
-
|
289
|
+
add_index :articles, :title, name: "idx_title"
|
505
290
|
|
506
|
-
|
507
|
-
|
291
|
+
# Before:
|
292
|
+
index_exists? :articles, :title, name: "idx_title" # => `true`
|
293
|
+
index_exists? :articles, :body, name: "idx_title" # => `true`
|
508
294
|
|
509
|
-
|
510
|
-
|
295
|
+
# After:
|
296
|
+
index_exists? :articles, :title, name: "idx_title" # => `true`
|
297
|
+
index_exists? :articles, :body, name: "idx_title" # => `false`
|
511
298
|
|
512
|
-
*
|
299
|
+
*Yves Senn*, *Matthew Draper*
|
513
300
|
|
514
|
-
*
|
515
|
-
|
301
|
+
* `add_timestamps` and `t.timestamps` now require you to pass the `:null` option.
|
302
|
+
Not passing the option is deprecated but the default is still `null: true`.
|
303
|
+
With Rails 5 this will change to `null: false`.
|
516
304
|
|
517
|
-
*
|
305
|
+
*Sean Griffin*
|
518
306
|
|
519
|
-
* `
|
520
|
-
|
521
|
-
|
522
|
-
similar objects.
|
307
|
+
* When calling `update_columns` on a record that is not persisted, the error
|
308
|
+
message now reflects whether that object is a new record or has been
|
309
|
+
destroyed.
|
523
310
|
|
524
|
-
|
311
|
+
*Lachlan Sylvester*
|
525
312
|
|
526
|
-
|
313
|
+
* Define `id_was` to get the previous value of the primary key.
|
527
314
|
|
528
|
-
|
529
|
-
|
315
|
+
Currently when we call `id_was` and we have a custom primary key name,
|
316
|
+
Active Record will return the current value of the primary key. This
|
317
|
+
makes it impossible to correctly do an update operation if you change the
|
318
|
+
id.
|
530
319
|
|
531
|
-
Fixes #
|
320
|
+
Fixes #16413.
|
532
321
|
|
533
|
-
*
|
322
|
+
*Rafael Mendonça França*
|
534
323
|
|
535
|
-
* Deprecate
|
536
|
-
|
324
|
+
* Deprecate `DatabaseTasks.load_schema` to act on the current connection.
|
325
|
+
Use `.load_schema_current` instead. In the future `load_schema` will
|
326
|
+
require the `configuration` to act on as an argument.
|
537
327
|
|
538
328
|
*Yves Senn*
|
539
329
|
|
540
|
-
*
|
541
|
-
|
542
|
-
doesn't stop you manually running other tasks on your test database
|
543
|
-
if needed:
|
544
|
-
|
545
|
-
rake db:schema:load RAILS_ENV=test
|
546
|
-
|
547
|
-
*Jon Leighton*
|
548
|
-
|
549
|
-
* Fix presence validator for association when the associated record responds to `to_a`.
|
550
|
-
|
551
|
-
*gmarik*
|
552
|
-
|
553
|
-
* Fixed regression on preload/includes with multiple arguments failing in certain conditions,
|
554
|
-
raising a NoMethodError internally by calling `reflect_on_association` for `NilClass:Class`.
|
330
|
+
* Fix automatic maintaining test schema to properly handle sql structure
|
331
|
+
schema format.
|
555
332
|
|
556
|
-
Fixes #
|
333
|
+
Fixes #15394.
|
557
334
|
|
558
|
-
*
|
335
|
+
*Wojciech Wnętrzak*
|
559
336
|
|
560
|
-
*
|
337
|
+
* Fix type casting to Decimal from Float with large precision.
|
561
338
|
|
562
|
-
|
339
|
+
*Tomohiro Hashidate*
|
563
340
|
|
564
|
-
|
565
|
-
enum gender: [:female, :male]
|
566
|
-
end
|
341
|
+
* Deprecate `Reflection#source_macro`
|
567
342
|
|
568
|
-
|
343
|
+
`Reflection#source_macro` is no longer needed in Active Record
|
344
|
+
source so it has been deprecated. Code that used `source_macro`
|
345
|
+
was removed in #16353.
|
569
346
|
|
570
|
-
|
571
|
-
conversation.female!
|
572
|
-
conversation.female? # => true
|
573
|
-
conversation.gender # => "female"
|
347
|
+
*Eileen M. Uchtitelle*, *Aaron Patterson*
|
574
348
|
|
575
|
-
|
576
|
-
conversation.gender = nil
|
577
|
-
conversation.gender.nil? # => true
|
578
|
-
conversation.gender # => nil
|
349
|
+
* No verbose backtrace by `db:drop` when database does not exist.
|
579
350
|
|
580
|
-
|
351
|
+
Fixes #16295.
|
581
352
|
|
582
|
-
*
|
583
|
-
key is expected to contain a database URL. The database URL will be
|
584
|
-
expanded into a hash and merged.
|
353
|
+
*Kenn Ejima*
|
585
354
|
|
586
|
-
|
587
|
-
|
588
|
-
* An `ArgumentError` is now raised on a call to `Relation#where.not(nil)`.
|
355
|
+
* Add support for PostgreSQL JSONB.
|
589
356
|
|
590
357
|
Example:
|
591
358
|
|
592
|
-
|
593
|
-
|
594
|
-
# Before
|
595
|
-
# => 'SELECT `users`.* FROM `users` WHERE (NOT (NULL))'
|
596
|
-
|
597
|
-
# After
|
598
|
-
# => ArgumentError, 'Invalid argument for .where.not(), got nil.'
|
599
|
-
|
600
|
-
*Kuldeep Aggarwal*
|
601
|
-
|
602
|
-
* Deprecated use of string argument as a configuration lookup in
|
603
|
-
`ActiveRecord::Base.establish_connection`. Instead, a symbol must be given.
|
604
|
-
|
605
|
-
*José Valim*
|
606
|
-
|
607
|
-
* Fixed `update_column`, `update_columns`, and `update_all` to correctly serialize
|
608
|
-
values for `array`, `hstore` and `json` column types in PostgreSQL.
|
609
|
-
|
610
|
-
Fixes #12261.
|
611
|
-
|
612
|
-
*Tadas Tamosauskas*, *Carlos Antonio da Silva*
|
613
|
-
|
614
|
-
* Do not consider PostgreSQL array columns as number or text columns.
|
615
|
-
|
616
|
-
The code uses these checks in several places to know what to do with a
|
617
|
-
particular column, for instance AR attribute query methods has a branch
|
618
|
-
like this:
|
619
|
-
|
620
|
-
if column.number?
|
621
|
-
!value.zero?
|
359
|
+
create_table :posts do |t|
|
360
|
+
t.jsonb :meta_data
|
622
361
|
end
|
623
362
|
|
624
|
-
|
625
|
-
as running [].zero?, which results in a NoMethodError exception.
|
363
|
+
*Philippe Creux*, *Chris Teague*
|
626
364
|
|
627
|
-
|
628
|
-
true for number?/text? checks.
|
365
|
+
* `db:purge` with MySQL respects `Rails.env`.
|
629
366
|
|
630
|
-
*
|
631
|
-
|
632
|
-
* When connecting to a non-existant database, the error:
|
633
|
-
`ActiveRecord::NoDatabaseError` will now be raised. When being used with Rails
|
634
|
-
the error message will include information on how to create a database:
|
635
|
-
`rake db:create`. Supported adapters: postgresql, mysql, mysql2, sqlite3
|
636
|
-
|
637
|
-
*Richard Schneeman*
|
638
|
-
|
639
|
-
* Do not raise `'cannot touch on a new record object'` exception on destroying
|
640
|
-
already destroyed `belongs_to` association with `touch: true` option.
|
641
|
-
|
642
|
-
Fixes #13445.
|
643
|
-
|
644
|
-
Example:
|
367
|
+
*Yves Senn*
|
645
368
|
|
646
|
-
|
647
|
-
|
648
|
-
comment.destroy # no longer raises an error
|
369
|
+
* `change_column_default :table, :column, nil` with PostgreSQL will issue a
|
370
|
+
`DROP DEFAULT` instead of a `DEFAULT NULL` query.
|
649
371
|
|
650
|
-
|
372
|
+
Fixes #16261.
|
651
373
|
|
652
|
-
*
|
653
|
-
PostgreSQL integer array column.
|
374
|
+
*Matthew Draper*, *Yves Senn*
|
654
375
|
|
655
|
-
|
376
|
+
* Allow to specify a type for the foreign key column in `references`
|
377
|
+
and `add_reference`.
|
656
378
|
|
657
379
|
Example:
|
658
380
|
|
659
|
-
|
660
|
-
|
661
|
-
|
381
|
+
change_table :vehicle do |t|
|
382
|
+
t.references :station, type: :uuid
|
383
|
+
end
|
662
384
|
|
663
|
-
*
|
385
|
+
*Andrey Novikov*, *Łukasz Sarnacki*
|
664
386
|
|
665
|
-
*
|
387
|
+
* `create_join_table` removes a common prefix when generating the join table.
|
388
|
+
This matches the existing behavior of HABTM associations.
|
666
389
|
|
667
|
-
|
390
|
+
Fixes #13683.
|
668
391
|
|
669
|
-
|
670
|
-
number)
|
671
|
-
values(
|
672
|
-
5152
|
673
|
-
)
|
392
|
+
*Stefan Kanev*
|
674
393
|
|
675
|
-
|
676
|
-
|
394
|
+
* Do not swallow errors on `compute_type` when having a bad `alias_method` on
|
395
|
+
a class.
|
677
396
|
|
678
|
-
*
|
397
|
+
*arthurnn*
|
679
398
|
|
680
|
-
*
|
399
|
+
* PostgreSQL invalid `uuid` are convert to nil.
|
681
400
|
|
682
|
-
|
401
|
+
*Abdelkader Boudih*
|
683
402
|
|
684
|
-
*
|
685
|
-
to an `Array` by calling `#to_a` before using these methods.
|
403
|
+
* Restore 4.0 behavior for using serialize attributes with `JSON` as coder.
|
686
404
|
|
687
|
-
|
688
|
-
|
405
|
+
With 4.1.x, `serialize` started returning a string when `JSON` was passed as
|
406
|
+
the second attribute. It will now return a hash as per previous versions.
|
689
407
|
|
690
408
|
Example:
|
691
409
|
|
692
|
-
# Instead of this
|
693
|
-
Author.where(name: 'Hank Moody').compact!
|
694
|
-
|
695
|
-
# Now you have to do this
|
696
|
-
authors = Author.where(name: 'Hank Moody').to_a
|
697
|
-
authors.compact!
|
698
|
-
|
699
|
-
*Lauro Caetano*
|
700
|
-
|
701
|
-
* Better support for `where()` conditions that use a `belongs_to`
|
702
|
-
association name.
|
703
|
-
|
704
|
-
Using the name of an association in `where` previously worked only
|
705
|
-
if the value was a single `ActiveRecord::Base` object. e.g.
|
706
|
-
|
707
|
-
Post.where(author: Author.first)
|
708
|
-
|
709
|
-
Any other values, including `nil`, would cause invalid SQL to be
|
710
|
-
generated. This change supports arguments in the `where` query
|
711
|
-
conditions where the key is a `belongs_to` association name and the
|
712
|
-
value is `nil`, an `Array` of `ActiveRecord::Base` objects, or an
|
713
|
-
`ActiveRecord::Relation` object.
|
714
|
-
|
715
410
|
class Post < ActiveRecord::Base
|
716
|
-
|
411
|
+
serialize :comment, JSON
|
717
412
|
end
|
718
413
|
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
# SELECT "posts".* FROM "posts" WHERE "posts"."author_id" IS NULL
|
723
|
-
|
724
|
-
`Array` values find records where the association foreign key
|
725
|
-
matches the ids of the passed ActiveRecord models, resulting
|
726
|
-
in the same query as `Post.where(author_id: [1,2])`:
|
727
|
-
|
728
|
-
authors_array = [Author.find(1), Author.find(2)]
|
729
|
-
Post.where(author: authors_array)
|
730
|
-
# SELECT "posts".* FROM "posts" WHERE "posts"."author_id" IN (1, 2)
|
731
|
-
|
732
|
-
`ActiveRecord::Relation` values find records using the same
|
733
|
-
query as `Post.where(author_id: Author.where(last_name: "Emde"))`
|
734
|
-
|
735
|
-
Post.where(author: Author.where(last_name: "Emde"))
|
736
|
-
# SELECT "posts".* FROM "posts"
|
737
|
-
# WHERE "posts"."author_id" IN (
|
738
|
-
# SELECT "authors"."id" FROM "authors"
|
739
|
-
# WHERE "authors"."last_name" = 'Emde')
|
740
|
-
|
741
|
-
Polymorphic `belongs_to` associations will continue to be handled
|
742
|
-
appropriately, with the polymorphic `association_type` field added
|
743
|
-
to the query to match the base class of the value. This feature
|
744
|
-
previously only worked when the value was a single `ActveRecord::Base`.
|
745
|
-
|
746
|
-
class Post < ActiveRecord::Base
|
747
|
-
belongs_to :author, polymorphic: true
|
414
|
+
class Comment
|
415
|
+
include ActiveModel::Model
|
416
|
+
attr_accessor :category, :text
|
748
417
|
end
|
749
418
|
|
750
|
-
Post.
|
751
|
-
|
752
|
-
|
419
|
+
post = Post.create!
|
420
|
+
post.comment = Comment.new(category: "Animals", text: "This is a comment about squirrels.")
|
421
|
+
post.save!
|
753
422
|
|
754
|
-
|
423
|
+
# 4.0
|
424
|
+
post.comment # => {"category"=>"Animals", "text"=>"This is a comment about squirrels."}
|
755
425
|
|
756
|
-
|
426
|
+
# 4.1 before
|
427
|
+
post.comment # => "#<Comment:0x007f80ab48ff98>"
|
757
428
|
|
758
|
-
|
429
|
+
# 4.1 after
|
430
|
+
post.comment # => {"category"=>"Animals", "text"=>"This is a comment about squirrels."}
|
759
431
|
|
760
|
-
|
432
|
+
When using `JSON` as the coder in `serialize`, Active Record will use the
|
433
|
+
new `ActiveRecord::Coders::JSON` coder which delegates its `dump/load` to
|
434
|
+
`ActiveSupport::JSON.encode/decode`. This ensures special objects are dumped
|
435
|
+
correctly using the `#as_json` hook.
|
761
436
|
|
762
|
-
|
763
|
-
|
764
|
-
* Add option to create tables from a query.
|
437
|
+
To keep the previous behaviour, supply a custom coder instead
|
438
|
+
([example](https://gist.github.com/jenncoop/8c4142bbe59da77daa63)).
|
765
439
|
|
766
|
-
|
767
|
-
as: "SELECT * FROM orders INNER JOIN line_items ON order_id=orders.id")
|
440
|
+
Fixes #15594.
|
768
441
|
|
769
|
-
|
442
|
+
*Jenn Cooper*
|
770
443
|
|
771
|
-
|
772
|
-
SELECT * FROM orders INNER JOIN line_items ON order_id=orders.id
|
444
|
+
* Do not use `RENAME INDEX` syntax for MariaDB 10.0.
|
773
445
|
|
774
|
-
|
775
|
-
|
776
|
-
* `db:test:clone` and `db:test:prepare` must load Rails environment.
|
777
|
-
|
778
|
-
`db:test:clone` and `db:test:prepare` use `ActiveRecord::Base`. configurations,
|
779
|
-
so we need to load the Rails environment, otherwise the config wont be in place.
|
780
|
-
|
781
|
-
*arthurnn*
|
782
|
-
|
783
|
-
* Use the right column to type cast grouped calculations with custom expressions.
|
784
|
-
|
785
|
-
Fixes #13230.
|
786
|
-
|
787
|
-
Example:
|
788
|
-
|
789
|
-
# Before
|
790
|
-
Account.group(:firm_name).sum('0.01 * credit_limit')
|
791
|
-
# => { '37signals' => '0.5' }
|
792
|
-
|
793
|
-
# After
|
794
|
-
Account.group(:firm_name).sum('0.01 * credit_limit')
|
795
|
-
# => { '37signals' => 0.5 }
|
796
|
-
|
797
|
-
*Paul Nikitochkin*
|
446
|
+
Fixes #15931.
|
798
447
|
|
799
|
-
*
|
800
|
-
the old and new owner correctly when moved between owners of different types.
|
448
|
+
*Jeff Browning*
|
801
449
|
|
802
|
-
|
450
|
+
* Calling `#empty?` on a `has_many` association would use the value from the
|
451
|
+
counter cache if one exists.
|
803
452
|
|
804
|
-
|
805
|
-
belongs_to :rateable, polymorphic: true, touch: true
|
806
|
-
end
|
453
|
+
*David Verhasselt*
|
807
454
|
|
808
|
-
|
809
|
-
|
455
|
+
* Fix the schema dump generated for tables without constraints and with
|
456
|
+
primary key with default value of custom PostgreSQL function result.
|
810
457
|
|
811
|
-
|
458
|
+
Fixes #16111.
|
812
459
|
|
813
|
-
*
|
814
|
-
with line breaks before/after, and improve the error for pending migrations.
|
460
|
+
*Andrey Novikov*
|
815
461
|
|
816
|
-
|
462
|
+
* Fix the SQL generated when a `delete_all` is run on an association to not
|
463
|
+
produce an `IN` statements.
|
817
464
|
|
818
|
-
|
465
|
+
Before:
|
819
466
|
|
820
|
-
|
467
|
+
UPDATE "categorizations" SET "category_id" = NULL WHERE
|
468
|
+
"categorizations"."category_id" = 1 AND "categorizations"."id" IN (1, 2)
|
821
469
|
|
822
|
-
|
823
|
-
# => returns the 4th record from the end.
|
470
|
+
After:
|
824
471
|
|
825
|
-
|
472
|
+
UPDATE "categorizations" SET "category_id" = NULL WHERE
|
473
|
+
"categorizations"."category_id" = 1
|
826
474
|
|
827
|
-
*
|
475
|
+
*Eileen M. Uchitelle, Aaron Patterson*
|
828
476
|
|
829
|
-
*
|
830
|
-
|
477
|
+
* Avoid type casting boolean and `ActiveSupport::Duration` values to numeric
|
478
|
+
values for string columns. Otherwise, in some database, the string column
|
479
|
+
values will be coerced to a numeric allowing false or 0.seconds match any
|
480
|
+
string starting with a non-digit.
|
831
481
|
|
832
482
|
Example:
|
833
483
|
|
834
|
-
|
484
|
+
App.where(apikey: false) # => SELECT * FROM users WHERE apikey = '0'
|
835
485
|
|
836
|
-
|
486
|
+
*Dylan Thacker-Smith*
|
837
487
|
|
838
|
-
|
488
|
+
* Add a `:required` option to singular associations, providing a nicer
|
489
|
+
API for presence validations on associations.
|
839
490
|
|
840
|
-
*
|
841
|
-
after leaving the outer block instead of clearing it right after the inner block is finished.
|
491
|
+
*Sean Griffin*
|
842
492
|
|
843
|
-
|
493
|
+
* Fix an error in `reset_counters` when associations have `select` scope.
|
494
|
+
(Call to `count` generated invalid SQL.)
|
844
495
|
|
845
|
-
*
|
846
|
-
object. Helper methods used by multiple fixtures should be defined on the
|
847
|
-
class object returned by `ActiveRecord::FixtureSet.context_class`.
|
496
|
+
*Cade Truitt*
|
848
497
|
|
849
|
-
|
498
|
+
* After a successful `reload`, `new_record?` is always false.
|
850
499
|
|
851
|
-
|
852
|
-
option, but never actually supported it. Now it will raise an `ArgumentError`
|
853
|
-
when using `has_one` with `counter_cache`.
|
500
|
+
Fixes #12101.
|
854
501
|
|
855
|
-
*
|
856
|
-
|
857
|
-
* Implement `rename_index` natively for MySQL >= 5.7.
|
502
|
+
*Matthew Draper*
|
858
503
|
|
859
|
-
|
504
|
+
* PostgreSQL renaming table doesn't attempt to rename non existent sequences.
|
860
505
|
|
861
|
-
*
|
506
|
+
*Abdelkader Boudih*
|
862
507
|
|
863
|
-
|
508
|
+
* Move 'dependent: :destroy' handling for `belongs_to`
|
509
|
+
from `before_destroy` to `after_destroy` callback chain
|
864
510
|
|
865
|
-
|
511
|
+
Fixes #12380.
|
866
512
|
|
867
|
-
*
|
513
|
+
*Ivan Antropov*
|
868
514
|
|
869
|
-
|
515
|
+
* Detect in-place modifications on String attributes.
|
870
516
|
|
871
|
-
|
517
|
+
Before this change, an attribute modified in-place had to be marked as
|
518
|
+
changed in order for it to be persisted in the database. Now it is no longer
|
519
|
+
required.
|
872
520
|
|
873
|
-
|
874
|
-
rename indexes on columns with a foreign key and prevents the following error:
|
521
|
+
Before:
|
875
522
|
|
876
|
-
|
523
|
+
user = User.first
|
524
|
+
user.name << ' Griffin'
|
525
|
+
user.name_will_change!
|
526
|
+
user.save
|
527
|
+
user.reload.name # => "Sean Griffin"
|
877
528
|
|
878
|
-
|
529
|
+
After:
|
879
530
|
|
880
|
-
|
881
|
-
|
531
|
+
user = User.first
|
532
|
+
user.name << ' Griffin'
|
533
|
+
user.save
|
534
|
+
user.reload.name # => "Sean Griffin"
|
882
535
|
|
883
|
-
|
536
|
+
*Sean Griffin*
|
884
537
|
|
885
|
-
|
538
|
+
* Add `ActiveRecord::Base#validate!` that raises `RecordInvalid` if the record
|
539
|
+
is invalid.
|
886
540
|
|
887
|
-
*
|
541
|
+
*Bogdan Gusiev*, *Marc Schütz*
|
888
542
|
|
889
|
-
|
543
|
+
* Support for adding and removing foreign keys. Foreign keys are now
|
544
|
+
a part of `schema.rb`. This is supported by Mysql2Adapter, MysqlAdapter
|
545
|
+
and PostgreSQLAdapter.
|
890
546
|
|
891
|
-
*
|
547
|
+
Many thanks to *Matthew Higgins* for laying the foundation with his work on
|
548
|
+
[foreigner](https://github.com/matthuhiggins/foreigner).
|
892
549
|
|
893
|
-
|
550
|
+
Example:
|
894
551
|
|
895
|
-
|
552
|
+
# within your migrations:
|
553
|
+
add_foreign_key :articles, :authors
|
554
|
+
remove_foreign_key :articles, :authors
|
896
555
|
|
897
556
|
*Yves Senn*
|
898
557
|
|
899
|
-
*
|
558
|
+
* Fix subtle bugs regarding attribute assignment on models with no primary
|
559
|
+
key. `'id'` will no longer be part of the attributes hash.
|
900
560
|
|
901
|
-
*
|
561
|
+
*Sean Griffin*
|
902
562
|
|
903
|
-
*
|
563
|
+
* Deprecate automatic counter caches on `has_many :through`. The behavior was
|
564
|
+
broken and inconsistent.
|
904
565
|
|
905
|
-
|
566
|
+
*Sean Griffin*
|
906
567
|
|
907
|
-
|
908
|
-
to_param :name
|
909
|
-
end
|
568
|
+
* `preload` preserves readonly flag for associations.
|
910
569
|
|
911
|
-
|
912
|
-
user.id # => 123
|
913
|
-
user.to_param # => "123-fancy-pants"
|
570
|
+
See #15853.
|
914
571
|
|
915
|
-
*
|
572
|
+
*Yves Senn*
|
916
573
|
|
917
|
-
*
|
574
|
+
* Assume numeric types have changed if they were assigned to a value that
|
575
|
+
would fail numericality validation, regardless of the old value. Previously
|
576
|
+
this would only occur if the old value was 0.
|
918
577
|
|
919
578
|
Example:
|
920
579
|
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
*Sam Stephenson*, *Damien Mathieu*
|
580
|
+
model = Model.create!(number: 5)
|
581
|
+
model.number = '5wibble'
|
582
|
+
model.number_changed? # => true
|
926
583
|
|
927
|
-
|
928
|
-
a record on a `has_many :through` association.
|
584
|
+
Fixes #14731.
|
929
585
|
|
930
|
-
|
586
|
+
*Sean Griffin*
|
931
587
|
|
932
|
-
|
588
|
+
* `reload` no longer merges with the existing attributes.
|
589
|
+
The attribute hash is fully replaced. The record is put into the same state
|
590
|
+
as it would be with `Model.find(model.id)`.
|
933
591
|
|
934
|
-
*
|
935
|
-
`type_cast` will return `1` for `true` and `0` for `false`.
|
592
|
+
*Sean Griffin*
|
936
593
|
|
937
|
-
|
594
|
+
* The object returned from `select_all` must respond to `column_types`.
|
595
|
+
If this is not the case a `NoMethodError` is raised.
|
938
596
|
|
939
|
-
*
|
597
|
+
*Sean Griffin*
|
940
598
|
|
941
|
-
*
|
599
|
+
* Detect in-place modifications of PG array types
|
942
600
|
|
943
|
-
|
601
|
+
*Sean Griffin*
|
944
602
|
|
945
|
-
|
946
|
-
|
947
|
-
* Log bind variables after they are type casted. This makes it more
|
948
|
-
transparent what values are actually sent to the database.
|
949
|
-
|
950
|
-
irb(main):002:0> Event.find("im-no-integer")
|
951
|
-
# Before: ... WHERE "events"."id" = $1 LIMIT 1 [["id", "im-no-integer"]]
|
952
|
-
# After: ... WHERE "events"."id" = $1 LIMIT 1 [["id", 0]]
|
603
|
+
* Add `bin/rake db:purge` task to empty the current database.
|
953
604
|
|
954
605
|
*Yves Senn*
|
955
606
|
|
956
|
-
*
|
957
|
-
|
958
|
-
Fixes #12790.
|
959
|
-
|
960
|
-
*Jason Ayre*
|
961
|
-
|
962
|
-
* `.unscope` now removes conditions specified in `default_scope`.
|
963
|
-
|
964
|
-
*Jon Leighton*
|
607
|
+
* Deprecate `serialized_attributes` without replacement.
|
965
608
|
|
966
|
-
*
|
609
|
+
*Sean Griffin*
|
967
610
|
|
968
|
-
|
611
|
+
* Correctly extract IPv6 addresses from `DATABASE_URI`: the square brackets
|
612
|
+
are part of the URI structure, not the actual host.
|
969
613
|
|
970
|
-
|
971
|
-
Post.where(trashed: true).rewhere(trashed: false) #=> WHERE `trashed` = 0
|
972
|
-
Post.where(active: true).where(trashed: true).rewhere(trashed: false) #=> WHERE `active` = 1 AND `trashed` = 0
|
614
|
+
Fixes #15705.
|
973
615
|
|
974
|
-
*
|
616
|
+
*Andy Bakun*, *Aaron Stone*
|
975
617
|
|
976
|
-
*
|
618
|
+
* Ensure both parent IDs are set on join records when both sides of a
|
619
|
+
through association are new.
|
977
620
|
|
978
|
-
|
979
|
-
|
980
|
-
# last_reviewed_at will be used, if that's more recent than updated_at, or vice versa
|
981
|
-
Person.find(5).cache_key(:updated_at, :last_reviewed_at)
|
982
|
-
|
983
|
-
*DHH*
|
984
|
-
|
985
|
-
* Added `ActiveRecord::Base#enum` for declaring enum attributes where the values map to integers in the database, but can be queried by name.
|
986
|
-
|
987
|
-
Example:
|
988
|
-
|
989
|
-
class Conversation < ActiveRecord::Base
|
990
|
-
enum status: [:active, :archived]
|
991
|
-
end
|
992
|
-
|
993
|
-
Conversation::STATUS # => { active: 0, archived: 1 }
|
994
|
-
|
995
|
-
# conversation.update! status: 0
|
996
|
-
conversation.active!
|
997
|
-
conversation.active? # => true
|
998
|
-
conversation.status # => "active"
|
999
|
-
|
1000
|
-
# conversation.update! status: 1
|
1001
|
-
conversation.archived!
|
1002
|
-
conversation.archived? # => true
|
1003
|
-
conversation.status # => "archived"
|
1004
|
-
|
1005
|
-
# conversation.update! status: 1
|
1006
|
-
conversation.status = :archived
|
1007
|
-
|
1008
|
-
*DHH*
|
621
|
+
*Sean Griffin*
|
1009
622
|
|
1010
|
-
* `ActiveRecord::
|
623
|
+
* `ActiveRecord::Dirty` now detects in-place changes to mutable values.
|
624
|
+
Serialized attributes on ActiveRecord models will no longer save when
|
625
|
+
unchanged.
|
1011
626
|
|
1012
|
-
|
627
|
+
Fixes #8328.
|
1013
628
|
|
1014
|
-
*
|
629
|
+
*Sean Griffin*
|
1015
630
|
|
1016
|
-
|
631
|
+
* `Pluck` now works when selecting columns from different tables with the same
|
632
|
+
name.
|
1017
633
|
|
1018
|
-
|
1019
|
-
Fixed bug when providing `includes` in through association scope, and fetching targets.
|
634
|
+
Fixes #15649.
|
1020
635
|
|
1021
|
-
|
636
|
+
*Sean Griffin*
|
1022
637
|
|
1023
|
-
|
1024
|
-
has_many :relationships, -> { includes(:user) }
|
1025
|
-
has_many :users, through: :relationships
|
1026
|
-
end
|
638
|
+
* Remove `cache_attributes` and friends. All attributes are cached.
|
1027
639
|
|
1028
|
-
|
640
|
+
*Sean Griffin*
|
1029
641
|
|
1030
|
-
|
642
|
+
* Remove deprecated method `ActiveRecord::Base.quoted_locking_column`.
|
1031
643
|
|
1032
|
-
|
644
|
+
*Akshay Vishnoi*
|
1033
645
|
|
1034
|
-
|
646
|
+
* `ActiveRecord::FinderMethods.find` with block can handle proc parameter as
|
647
|
+
`Enumerable#find` does.
|
1035
648
|
|
1036
|
-
|
649
|
+
Fixes #15382.
|
1037
650
|
|
1038
|
-
|
651
|
+
*James Yang*
|
1039
652
|
|
1040
|
-
|
653
|
+
* Make timezone aware attributes work with PostgreSQL array columns.
|
1041
654
|
|
1042
|
-
|
1043
|
-
with reading from the database.
|
655
|
+
Fixes #13402.
|
1044
656
|
|
1045
|
-
|
657
|
+
*Kuldeep Aggarwal*, *Sean Griffin*
|
1046
658
|
|
1047
|
-
|
659
|
+
* `ActiveRecord::SchemaMigration` has no primary key regardless of the
|
660
|
+
`primary_key_prefix_type` configuration.
|
1048
661
|
|
1049
|
-
|
1050
|
-
x.tags # => {"string" => "foo", :symbol => :bar}
|
1051
|
-
|
1052
|
-
# After:
|
1053
|
-
x.tags # => {"string" => "foo", "symbol" => "bar"}
|
662
|
+
Fixes #15051.
|
1054
663
|
|
1055
|
-
*
|
664
|
+
*JoseLuis Torres*, *Yves Senn*
|
1056
665
|
|
1057
|
-
* `
|
666
|
+
* `rake db:migrate:status` works with legacy migration numbers like `00018_xyz.rb`.
|
1058
667
|
|
1059
|
-
Fixes #
|
668
|
+
Fixes #15538.
|
1060
669
|
|
1061
670
|
*Yves Senn*
|
1062
671
|
|
1063
|
-
*
|
1064
|
-
all registered `stored_attributes`. Now every subclass of
|
1065
|
-
`ActiveRecord::Base` has it's own `Hash`.
|
1066
|
-
|
1067
|
-
*Yves Senn*
|
1068
|
-
|
1069
|
-
* Save `has_one` association when primary key is manually set.
|
1070
|
-
|
1071
|
-
Fixes #12302.
|
1072
|
-
|
1073
|
-
*Lauro Caetano*
|
672
|
+
* Baseclass becomes! subclass.
|
1074
673
|
|
1075
|
-
|
674
|
+
Before this change, a record which changed its STI type, could not be
|
675
|
+
updated.
|
1076
676
|
|
1077
|
-
|
677
|
+
Fixes #14785.
|
1078
678
|
|
1079
|
-
*
|
1080
|
-
bind values and have invalid syntax.
|
679
|
+
*Matthew Draper*, *Earl St Sauver*, *Edo Balvers*
|
1081
680
|
|
1082
|
-
|
681
|
+
* Remove deprecated `ActiveRecord::Migrator.proper_table_name`. Use the
|
682
|
+
`proper_table_name` instance method on `ActiveRecord::Migration` instead.
|
1083
683
|
|
1084
|
-
|
684
|
+
*Akshay Vishnoi*
|
1085
685
|
|
1086
|
-
|
686
|
+
* Fix regression on eager loading association based on SQL query rather than
|
687
|
+
existing column.
|
1087
688
|
|
1088
|
-
|
1089
|
-
spaces.
|
689
|
+
Fixes #15480.
|
1090
690
|
|
1091
|
-
*
|
691
|
+
*Lauro Caetano*, *Carlos Antonio da Silva*
|
1092
692
|
|
1093
|
-
* `
|
693
|
+
* Deprecate returning `nil` from `column_for_attribute` when no column exists.
|
694
|
+
It will return a null object in Rails 5.0
|
1094
695
|
|
1095
|
-
|
1096
|
-
operators, i.e. `Arel::Nodes::NotIn` and `Arel::Nodes::NotEqual` that have
|
1097
|
-
been generated through the use of `where.not`.
|
696
|
+
*Sean Griffin*
|
1098
697
|
|
1099
|
-
|
698
|
+
* Implemented `ActiveRecord::Base#pretty_print` to work with PP.
|
1100
699
|
|
1101
|
-
*
|
700
|
+
*Ethan*
|
1102
701
|
|
1103
|
-
|
702
|
+
* Preserve type when dumping PostgreSQL point, bit, bit varying and money
|
703
|
+
columns.
|
1104
704
|
|
1105
|
-
*
|
1106
|
-
|
1107
|
-
*Szymon Nowak*
|
1108
|
-
|
1109
|
-
* `rake db:structure:dump` no longer crashes when the port was specified as `Fixnum`.
|
1110
|
-
|
1111
|
-
*Kenta Okamoto*
|
1112
|
-
|
1113
|
-
* `NullRelation#pluck` takes a list of columns
|
1114
|
-
|
1115
|
-
The method signature in `NullRelation` was updated to mimic that in
|
1116
|
-
`Calculations`.
|
1117
|
-
|
1118
|
-
*Derek Prior*
|
1119
|
-
|
1120
|
-
* `scope_chain` should not be mutated for other reflections.
|
1121
|
-
|
1122
|
-
Currently `scope_chain` uses same array for building different
|
1123
|
-
`scope_chain` for different associations. During processing
|
1124
|
-
these arrays are sometimes mutated and because of in-place
|
1125
|
-
mutation the changed `scope_chain` impacts other reflections.
|
1126
|
-
|
1127
|
-
Fix is to dup the value before adding to the `scope_chain`.
|
1128
|
-
|
1129
|
-
Fixes #3882.
|
1130
|
-
|
1131
|
-
*Neeraj Singh*
|
1132
|
-
|
1133
|
-
* Prevent the inversed association from being reloaded on save.
|
1134
|
-
|
1135
|
-
Fixes #9499.
|
1136
|
-
|
1137
|
-
*Dmitry Polushkin*
|
1138
|
-
|
1139
|
-
* Generate subquery for `Relation` if it passed as array condition for `where`
|
1140
|
-
method.
|
1141
|
-
|
1142
|
-
Example:
|
1143
|
-
|
1144
|
-
# Before
|
1145
|
-
Blog.where('id in (?)', Blog.where(id: 1))
|
1146
|
-
# => SELECT "blogs".* FROM "blogs" WHERE "blogs"."id" = 1
|
1147
|
-
# => SELECT "blogs".* FROM "blogs" WHERE (id IN (1))
|
1148
|
-
|
1149
|
-
# After
|
1150
|
-
Blog.where('id in (?)', Blog.where(id: 1).select(:id))
|
1151
|
-
# => SELECT "blogs".* FROM "blogs"
|
1152
|
-
# WHERE "blogs"."id" IN (SELECT "blogs"."id" FROM "blogs" WHERE "blogs"."id" = 1)
|
1153
|
-
|
1154
|
-
Fixes #12415.
|
1155
|
-
|
1156
|
-
*Paul Nikitochkin*
|
1157
|
-
|
1158
|
-
* For missed association exception message
|
1159
|
-
which is raised in `ActiveRecord::Associations::Preloader` class
|
1160
|
-
added owner record class name in order to simplify to find problem code.
|
705
|
+
*Yves Senn*
|
1161
706
|
|
1162
|
-
|
707
|
+
* New records remain new after YAML serialization.
|
1163
708
|
|
1164
|
-
*
|
1165
|
-
`has_many :through`. Behavior should remain the same, if not, it is a bug.
|
709
|
+
*Sean Griffin*
|
1166
710
|
|
1167
|
-
*
|
1168
|
-
a savepoint name.
|
711
|
+
* PostgreSQL support default values for enum types. Fixes #7814.
|
1169
712
|
|
1170
713
|
*Yves Senn*
|
1171
714
|
|
1172
|
-
*
|
715
|
+
* PostgreSQL `default_sequence_name` respects schema. Fixes #7516.
|
1173
716
|
|
1174
717
|
*Yves Senn*
|
1175
718
|
|
1176
|
-
*
|
1177
|
-
|
1178
|
-
|
1179
|
-
Fixes #11676, #11675, #11376.
|
1180
|
-
|
1181
|
-
*Paul Nikitochkin*, *Peter Brown*, *Nthalk*
|
1182
|
-
|
1183
|
-
* Fixed `ActiveRecord::Associations::CollectionAssociation#find`
|
1184
|
-
when using `has_many` association with `:inverse_of` and finding an array of one element,
|
1185
|
-
it should return an array of one element too.
|
1186
|
-
|
1187
|
-
*arthurnn*
|
1188
|
-
|
1189
|
-
* Callbacks on has_many should access the in memory parent if a inverse_of is set.
|
1190
|
-
|
1191
|
-
*arthurnn*
|
1192
|
-
|
1193
|
-
* `ActiveRecord::ConnectionAdapters.string_to_time` respects
|
1194
|
-
string with timezone (e.g. Wed, 04 Sep 2013 20:30:00 JST).
|
1195
|
-
|
1196
|
-
Fixes #12278.
|
1197
|
-
|
1198
|
-
*kennyj*
|
1199
|
-
|
1200
|
-
* Calling `update_attributes` will now throw an `ArgumentError` whenever it
|
1201
|
-
gets a `nil` argument. More specifically, it will throw an error if the
|
1202
|
-
argument that it gets passed does not respond to to `stringify_keys`.
|
719
|
+
* Fix `columns_for_distinct` of PostgreSQL adapter to work correctly
|
720
|
+
with orders without sort direction modifiers.
|
1203
721
|
|
1204
|
-
|
1205
|
-
|
1206
|
-
@my_comment.update_attributes(nil) # => raises ArgumentError
|
722
|
+
*Nikolay Kondratyev*
|
1207
723
|
|
1208
|
-
|
724
|
+
* PostgreSQL `reset_pk_sequence!` respects schemas. Fixes #14719.
|
1209
725
|
|
1210
|
-
*
|
726
|
+
*Yves Senn*
|
1211
727
|
|
1212
|
-
|
728
|
+
* Keep PostgreSQL `hstore` and `json` attributes as `Hash` in `@attributes`.
|
729
|
+
Fixes duplication in combination with `store_accessor`.
|
1213
730
|
|
1214
|
-
|
731
|
+
Fixes #15369.
|
1215
732
|
|
1216
|
-
|
733
|
+
*Yves Senn*
|
1217
734
|
|
1218
|
-
|
735
|
+
* `rake railties:install:migrations` respects the order of railties.
|
1219
736
|
|
1220
|
-
*
|
1221
|
-
when using `has_many` association with `:inverse_of` option and UUID primary key.
|
737
|
+
*Arun Agrawal*
|
1222
738
|
|
1223
|
-
|
739
|
+
* Fix redefine a `has_and_belongs_to_many` inside inherited class
|
740
|
+
Fixing regression case, where redefining the same `has_and_belongs_to_many`
|
741
|
+
definition into a subclass would raise.
|
1224
742
|
|
1225
|
-
|
743
|
+
Fixes #14983.
|
1226
744
|
|
1227
|
-
*
|
1228
|
-
where constraints and at least of them is not `Arel::Nodes::Equality`,
|
1229
|
-
generates invalid SQL expression.
|
745
|
+
*arthurnn*
|
1230
746
|
|
1231
|
-
|
747
|
+
* Fix `has_and_belongs_to_many` public reflection.
|
748
|
+
When defining a `has_and_belongs_to_many`, internally we convert that to two has_many.
|
749
|
+
But as `reflections` is a public API, people expect to see the right macro.
|
1232
750
|
|
1233
|
-
|
751
|
+
Fixes #14682.
|
1234
752
|
|
1235
|
-
*
|
1236
|
-
query to fetch results rather than loading the entire collection.
|
1237
|
-
|
1238
|
-
*Lann Martin*
|
753
|
+
*arthurnn*
|
1239
754
|
|
1240
|
-
*
|
755
|
+
* Fix serialization for records with an attribute named `format`.
|
1241
756
|
|
1242
|
-
|
757
|
+
Fixes #15188.
|
1243
758
|
|
1244
|
-
*
|
759
|
+
*Godfrey Chan*
|
1245
760
|
|
1246
|
-
|
761
|
+
* When a `group` is set, `sum`, `size`, `average`, `minimum` and `maximum`
|
762
|
+
on a NullRelation should return a Hash.
|
1247
763
|
|
1248
|
-
*
|
764
|
+
*Kuldeep Aggarwal*
|
1249
765
|
|
1250
|
-
|
766
|
+
* Fix serialized fields returning serialized data after being updated with
|
767
|
+
`update_column`.
|
1251
768
|
|
1252
|
-
*
|
769
|
+
*Simon Hørup Eskildsen*
|
1253
770
|
|
1254
|
-
*
|
1255
|
-
transaction.
|
771
|
+
* Fix polymorphic eager loading when using a String as foreign key.
|
1256
772
|
|
1257
|
-
|
773
|
+
Fixes #14734.
|
1258
774
|
|
1259
|
-
*
|
775
|
+
*Lauro Caetano*
|
1260
776
|
|
1261
|
-
|
777
|
+
* Change belongs_to touch to be consistent with timestamp updates
|
1262
778
|
|
1263
|
-
|
779
|
+
If a model is set up with a belongs_to: touch relationship the parent
|
780
|
+
record will only be touched if the record was modified. This makes it
|
781
|
+
consistent with timestamp updating on the record itself.
|
1264
782
|
|
1265
|
-
*
|
783
|
+
*Brock Trappitt*
|
1266
784
|
|
1267
|
-
* Fix
|
1268
|
-
|
1269
|
-
models, for example).
|
785
|
+
* Fix the inferred table name of a `has_and_belongs_to_many` auxiliary
|
786
|
+
table inside a schema.
|
1270
787
|
|
1271
|
-
|
788
|
+
Fixes #14824.
|
1272
789
|
|
1273
|
-
*
|
1274
|
-
parentheses (eg. `($1.25) # => -1.25`)).
|
1275
|
-
Fixes #11899.
|
790
|
+
*Eric Chahin*
|
1276
791
|
|
1277
|
-
|
792
|
+
* Remove unused `:timestamp` type. Transparently alias it to `:datetime`
|
793
|
+
in all cases. Fixes inconsistencies when column types are sent outside of
|
794
|
+
`ActiveRecord`, such as for XML Serialization.
|
1278
795
|
|
1279
|
-
*
|
1280
|
-
common STRING datatype in SQL.
|
796
|
+
*Sean Griffin*
|
1281
797
|
|
1282
|
-
|
798
|
+
* Fix bug that added `table_name_prefix` and `table_name_suffix` to
|
799
|
+
extension names in PostgreSQL when migrating.
|
1283
800
|
|
1284
|
-
*
|
801
|
+
*Joao Carlos*
|
1285
802
|
|
1286
|
-
|
803
|
+
* The `:index` option in migrations, which previously was only available for
|
804
|
+
`references`, now works with any column types.
|
1287
805
|
|
1288
|
-
*
|
806
|
+
*Marc Schütz*
|
1289
807
|
|
1290
|
-
|
808
|
+
* Add support for counter name to be passed as parameter on `CounterCache::ClassMethods#reset_counters`.
|
1291
809
|
|
1292
|
-
|
1293
|
-
record.logged_in_from_ip # is type of an inet or a cidr
|
810
|
+
*jnormore*
|
1294
811
|
|
1295
|
-
|
1296
|
-
|
812
|
+
* Restrict deletion of record when using `delete_all` with `uniq`, `group`, `having`
|
813
|
+
or `offset`.
|
1297
814
|
|
1298
|
-
|
1299
|
-
|
1300
|
-
record.logged_in_from_ip # => nil
|
1301
|
-
record.logged_in_from_ip_before_type_cast # => 'bad ip address'
|
815
|
+
In these cases the generated query ignored them and that caused unintended
|
816
|
+
records to be deleted.
|
1302
817
|
|
1303
|
-
|
818
|
+
Fixes #11985.
|
1304
819
|
|
1305
|
-
*
|
820
|
+
*Leandro Facchinetti*
|
1306
821
|
|
1307
|
-
|
822
|
+
* Floats with limit >= 25 that get turned into doubles in MySQL no longer have
|
823
|
+
their limit dropped from the schema.
|
1308
824
|
|
1309
|
-
|
825
|
+
Fixes #14135.
|
1310
826
|
|
1311
|
-
*
|
1312
|
-
assignment of `has_many` associations, when the association was not
|
1313
|
-
yet loaded:
|
827
|
+
*Aaron Nelson*
|
1314
828
|
|
1315
|
-
|
1316
|
-
|
829
|
+
* Fix how to calculate associated class name when using namespaced `has_and_belongs_to_many`
|
830
|
+
association.
|
1317
831
|
|
1318
|
-
|
1319
|
-
association target when a `:before_add` callback triggered the
|
1320
|
-
loading of the association
|
832
|
+
Fixes #14709.
|
1321
833
|
|
1322
|
-
*
|
834
|
+
*Kassio Borges*
|
1323
835
|
|
1324
|
-
*
|
836
|
+
* `ActiveRecord::Relation::Merger#filter_binds` now compares equivalent symbols and
|
837
|
+
strings in column names as equal.
|
1325
838
|
|
1326
|
-
|
839
|
+
This fixes a rare case in which more bind values are passed than there are
|
840
|
+
placeholders for them in the generated SQL statement, which can make PostgreSQL
|
841
|
+
throw a `StatementInvalid` exception.
|
1327
842
|
|
1328
|
-
*
|
1329
|
-
with reading from the database.
|
843
|
+
*Nat Budin*
|
1330
844
|
|
1331
|
-
|
845
|
+
* Fix `stored_attributes` to correctly merge the details of stored
|
846
|
+
attributes defined in parent classes.
|
1332
847
|
|
1333
|
-
|
848
|
+
Fixes #14672.
|
1334
849
|
|
1335
|
-
|
1336
|
-
x.tags # => {"bool" => true, "number" => 5}
|
850
|
+
*Brad Bennett*, *Jessica Yao*, *Lakshmi Parthasarathy*
|
1337
851
|
|
1338
|
-
|
1339
|
-
x.tags # => {"bool" => "true", "number" => "5"}
|
1340
|
-
|
1341
|
-
*Yves Senn* , *Severin Schoepke*
|
852
|
+
* `change_column_default` allows `[]` as argument to `change_column_default`.
|
1342
853
|
|
1343
|
-
|
854
|
+
Fixes #11586.
|
1344
855
|
|
1345
856
|
*Yves Senn*
|
1346
857
|
|
1347
|
-
*
|
1348
|
-
|
1349
|
-
Fixes #11773.
|
1350
|
-
|
1351
|
-
*Edo Balvers*
|
1352
|
-
|
1353
|
-
* Load fixtures from linked folders.
|
1354
|
-
|
1355
|
-
*Kassio Borges*
|
1356
|
-
|
1357
|
-
* Create a directory for sqlite3 file if not present on the system.
|
1358
|
-
|
1359
|
-
*Richard Schneeman*
|
858
|
+
* Handle `name` and `"char"` column types in the PostgreSQL adapter.
|
1360
859
|
|
1361
|
-
|
1362
|
-
|
860
|
+
`name` and `"char"` are special character types used internally by
|
861
|
+
PostgreSQL and are used by internal system catalogs. These field types
|
862
|
+
can sometimes show up in structure-sniffing queries that feature internal system
|
863
|
+
structures or with certain PostgreSQL extensions.
|
1363
864
|
|
1364
|
-
*
|
865
|
+
*J Smith*, *Yves Senn*
|
1365
866
|
|
1366
|
-
*
|
1367
|
-
|
867
|
+
* Fix `PostgreSQLAdapter::OID::Float#type_cast` to convert Infinity and
|
868
|
+
NaN PostgreSQL values into a native Ruby `Float::INFINITY` and `Float::NAN`
|
1368
869
|
|
1369
870
|
Before:
|
1370
871
|
|
1371
|
-
|
1372
|
-
#
|
872
|
+
Point.create(value: 1.0/0)
|
873
|
+
Point.last.value # => 0.0
|
1373
874
|
|
1374
875
|
After:
|
1375
876
|
|
1376
|
-
|
1377
|
-
#
|
877
|
+
Point.create(value: 1.0/0)
|
878
|
+
Point.last.value # => Infinity
|
1378
879
|
|
1379
|
-
|
880
|
+
*Innokenty Mikhailov*
|
1380
881
|
|
1381
|
-
*
|
1382
|
-
For example, adding a very vendor specific regex implementation:
|
882
|
+
* Allow the PostgreSQL adapter to handle bigserial primary key types again.
|
1383
883
|
|
1384
|
-
|
1385
|
-
Arel::Nodes::InfixOperation.new('~', column, value.source)
|
1386
|
-
end
|
1387
|
-
ActiveRecord::PredicateBuilder.register_handler(Regexp, regex_handler)
|
884
|
+
Fixes #10410.
|
1388
885
|
|
1389
|
-
*
|
886
|
+
*Patrick Robertson*
|
1390
887
|
|
1391
|
-
*
|
888
|
+
* Deprecate joining, eager loading and preloading of instance dependent
|
889
|
+
associations without replacement. These operations happen before instances
|
890
|
+
are created. The current behavior is unexpected and can result in broken
|
891
|
+
behavior.
|
1392
892
|
|
1393
|
-
|
1394
|
-
By enforcing the provision of the column for this internal method
|
1395
|
-
we ensure that those using adapters that require column information
|
1396
|
-
will always get the proper behavior.
|
893
|
+
Fixes #15024.
|
1397
894
|
|
1398
|
-
*
|
895
|
+
*Yves Senn*
|
1399
896
|
|
1400
|
-
*
|
1401
|
-
to allow the connection adapter to properly determine how to quote the value. This was
|
1402
|
-
affecting certain databases that use specific column types.
|
897
|
+
* Fix `has_and_belongs_to_many` CollectionAssociation size calculations.
|
1403
898
|
|
1404
|
-
|
899
|
+
`has_and_belongs_to_many` should fall back to using the normal CollectionAssociation's
|
900
|
+
size calculation if the collection is not cached or loaded.
|
1405
901
|
|
1406
|
-
|
902
|
+
Fixes #14913, #14914.
|
1407
903
|
|
1408
|
-
*
|
904
|
+
*Fred Wu*
|
1409
905
|
|
1410
|
-
|
906
|
+
* Return a non zero status when running `rake db:migrate:status` and migration table does
|
907
|
+
not exist.
|
1411
908
|
|
1412
|
-
|
1413
|
-
not rescue from Exception (but only from StandardError), the Connection
|
1414
|
-
Pool quickly runs out of connections when multiple erroneous Requests come
|
1415
|
-
in right after each other.
|
909
|
+
*Paul B.*
|
1416
910
|
|
1417
|
-
|
1418
|
-
behaviour.
|
911
|
+
* Add support for module-level `table_name_suffix` in models.
|
1419
912
|
|
1420
|
-
|
913
|
+
This makes `table_name_suffix` work the same way as `table_name_prefix` when
|
914
|
+
using namespaced models.
|
1421
915
|
|
1422
|
-
*
|
916
|
+
*Jenner LaFave*
|
1423
917
|
|
1424
|
-
|
918
|
+
* Revert the behaviour of `ActiveRecord::Relation#join` changed through 4.0 => 4.1 to 4.0.
|
1425
919
|
|
1426
|
-
|
920
|
+
In 4.1.0 `Relation#join` is delegated to `Arel#SelectManager`.
|
921
|
+
In 4.0 series it is delegated to `Array#join`.
|
1427
922
|
|
1428
|
-
*
|
923
|
+
*Bogdan Gusiev*
|
1429
924
|
|
1430
|
-
*
|
925
|
+
* Log nil binary column values correctly.
|
1431
926
|
|
1432
|
-
|
927
|
+
When an object with a binary column is updated with a nil value
|
928
|
+
in that column, the SQL logger would throw an exception when trying
|
929
|
+
to log that nil value. This only occurs when updating a record
|
930
|
+
that already has a non-nil value in that column since an initial nil
|
931
|
+
value isn't included in the SQL anyway (at least, when dirty checking
|
932
|
+
is enabled.) The column's new value will now be logged as `<NULL binary data>`
|
933
|
+
to parallel the existing `<N bytes of binary data>` for non-nil values.
|
1433
934
|
|
1434
|
-
*
|
935
|
+
*James Coleman*
|
1435
936
|
|
1436
|
-
*
|
1437
|
-
|
937
|
+
* Rails will now pass a custom validation context through to autosave associations
|
938
|
+
in order to validate child associations with the same context.
|
1438
939
|
|
1439
|
-
|
1440
|
-
self.column_defaults # if we call this unintentionally before setting locking_column ...
|
1441
|
-
self.locking_column = 'my_locking_column'
|
1442
|
-
end
|
940
|
+
Fixes #13854.
|
1443
941
|
|
1444
|
-
|
1445
|
-
=> nil # expected value is 0 !
|
942
|
+
*Eric Chahin*, *Aaron Nelson*, *Kevin Casey*
|
1446
943
|
|
1447
|
-
|
944
|
+
* Stringify all variables keys of MySQL connection configuration.
|
1448
945
|
|
1449
|
-
|
1450
|
-
|
946
|
+
When `sql_mode` variable for MySQL adapters set in configuration as `String`
|
947
|
+
was ignored and overwritten by strict mode option.
|
1451
948
|
|
1452
|
-
Fixes #
|
949
|
+
Fixes #14895.
|
1453
950
|
|
1454
951
|
*Paul Nikitochkin*
|
1455
952
|
|
1456
|
-
*
|
1457
|
-
`primary_keys`, `tables`, `columns` and `columns_hash`.
|
953
|
+
* Ensure SQLite3 statements are closed on errors.
|
1458
954
|
|
1459
|
-
|
955
|
+
Fixes #13631.
|
1460
956
|
|
1461
|
-
*
|
957
|
+
*Timur Alperovich*
|
1462
958
|
|
1463
|
-
|
959
|
+
* Give `ActiveRecord::PredicateBuilder` private methods the privacy they deserve.
|
1464
960
|
|
1465
|
-
*
|
961
|
+
*Hector Satre*
|
1466
962
|
|
1467
|
-
|
963
|
+
* When using a custom `join_table` name on a `habtm`, rails was not saving it
|
964
|
+
on Reflections. This causes a problem when rails loads fixtures, because it
|
965
|
+
uses the reflections to set database with fixtures.
|
1468
966
|
|
1469
|
-
|
967
|
+
Fixes #14845.
|
1470
968
|
|
1471
|
-
*
|
969
|
+
*Kassio Borges*
|
1472
970
|
|
1473
|
-
*
|
1474
|
-
|
971
|
+
* Reset the cache when modifying a Relation with cached Arel.
|
972
|
+
Additionally display a warning message to make the user aware.
|
1475
973
|
|
1476
|
-
*
|
974
|
+
*Yves Senn*
|
1477
975
|
|
1478
|
-
*
|
976
|
+
* PostgreSQL should internally use `:datetime` consistently for TimeStamp. Assures
|
977
|
+
different spellings of timestamps are treated the same.
|
1479
978
|
|
1480
|
-
|
979
|
+
Example:
|
1481
980
|
|
1482
|
-
|
981
|
+
mytimestamp.simplified_type('timestamp without time zone')
|
982
|
+
# => :datetime
|
983
|
+
mytimestamp.simplified_type('timestamp(6) without time zone')
|
984
|
+
# => also :datetime (previously would be :timestamp)
|
1483
985
|
|
1484
|
-
|
986
|
+
See #14513.
|
1485
987
|
|
1486
|
-
*
|
1487
|
-
method. You can use `#transaction_open?` instead.
|
988
|
+
*Jefferson Lai*
|
1488
989
|
|
1489
|
-
|
990
|
+
* `ActiveRecord::Base.no_touching` no longer triggers callbacks or start empty transactions.
|
1490
991
|
|
1491
|
-
|
1492
|
-
`ActiveRecord::Fixtures.default_fixture_model_name`.
|
992
|
+
Fixes #14841.
|
1493
993
|
|
1494
|
-
*
|
994
|
+
*Lucas Mazza*
|
1495
995
|
|
1496
|
-
*
|
996
|
+
* Fix name collision with `Array#select!` with `Relation#select!`.
|
1497
997
|
|
1498
|
-
|
998
|
+
Fixes #14752.
|
1499
999
|
|
1500
|
-
*
|
1000
|
+
*Earl St Sauver*
|
1501
1001
|
|
1502
|
-
|
1002
|
+
* Fix unexpected behavior for `has_many :through` associations going through
|
1003
|
+
a scoped `has_many`.
|
1503
1004
|
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1005
|
+
If a `has_many` association is adjusted using a scope, and another
|
1006
|
+
`has_many :through` uses this association, then the scope adjustment is
|
1007
|
+
unexpectedly neglected.
|
1507
1008
|
|
1508
|
-
|
1009
|
+
Fixes #14537.
|
1509
1010
|
|
1510
|
-
*
|
1511
|
-
in associations.
|
1011
|
+
*Jan Habermann*
|
1512
1012
|
|
1513
|
-
|
1013
|
+
* `@destroyed` should always be set to `false` when an object is duped.
|
1514
1014
|
|
1515
|
-
*
|
1015
|
+
*Kuldeep Aggarwal*
|
1516
1016
|
|
1517
|
-
|
1017
|
+
* Enable `has_many` associations to support irregular inflections.
|
1518
1018
|
|
1519
|
-
|
1019
|
+
Fixes #8928.
|
1520
1020
|
|
1521
|
-
*
|
1021
|
+
*arthurnn*, *Javier Goizueta*
|
1522
1022
|
|
1523
|
-
*
|
1023
|
+
* Fix `count` used with a grouping not returning a Hash.
|
1524
1024
|
|
1525
|
-
|
1025
|
+
Fixes #14721.
|
1526
1026
|
|
1527
|
-
*
|
1027
|
+
*Eric Chahin*
|
1528
1028
|
|
1529
|
-
|
1029
|
+
* `sanitize_sql_like` helper method to escape a string for safe use in an SQL
|
1030
|
+
LIKE statement.
|
1530
1031
|
|
1531
|
-
|
1032
|
+
Example:
|
1532
1033
|
|
1533
|
-
|
1034
|
+
class Article
|
1035
|
+
def self.search(term)
|
1036
|
+
where("title LIKE ?", sanitize_sql_like(term))
|
1037
|
+
end
|
1038
|
+
end
|
1534
1039
|
|
1535
|
-
|
1040
|
+
Article.search("20% _reduction_")
|
1041
|
+
# => Query looks like "... title LIKE '20\% \_reduction\_' ..."
|
1536
1042
|
|
1537
|
-
|
1538
|
-
feature was deprecated in Rails 4.0. This is being removed.
|
1539
|
-
`delete_all` will continue to honor the `:dependent` option. However
|
1540
|
-
if `:dependent` value is `:destroy` then the `:delete_all` deletion
|
1541
|
-
strategy for that collection will be applied.
|
1043
|
+
*Rob Gilson*, *Yves Senn*
|
1542
1044
|
|
1543
|
-
|
1544
|
-
`delete_all`. For example you can do `@post.comments.delete_all(:nullify)`.
|
1045
|
+
* Do not quote uuid default value on `change_column`.
|
1545
1046
|
|
1546
|
-
|
1047
|
+
Fixes #14604.
|
1547
1048
|
|
1548
|
-
*
|
1049
|
+
*Eric Chahin*
|
1549
1050
|
|
1550
|
-
|
1051
|
+
* The comparison between `Relation` and `CollectionProxy` should be consistent.
|
1551
1052
|
|
1552
|
-
|
1053
|
+
Example:
|
1553
1054
|
|
1554
|
-
|
1055
|
+
author.posts == Post.where(author_id: author.id)
|
1056
|
+
# => true
|
1057
|
+
Post.where(author_id: author.id) == author.posts
|
1058
|
+
# => true
|
1555
1059
|
|
1556
|
-
|
1557
|
-
association.
|
1060
|
+
Fixes #13506.
|
1558
1061
|
|
1559
|
-
|
1560
|
-
collection association.
|
1062
|
+
*Lauro Caetano*
|
1561
1063
|
|
1562
|
-
|
1064
|
+
* Calling `delete_all` on an unloaded `CollectionProxy` no longer
|
1065
|
+
generates an SQL statement containing each id of the collection:
|
1563
1066
|
|
1564
|
-
|
1565
|
-
Make sure to access it via the class.
|
1067
|
+
Before:
|
1566
1068
|
|
1567
|
-
|
1069
|
+
DELETE FROM `model` WHERE `model`.`parent_id` = 1
|
1070
|
+
AND `model`.`id` IN (1, 2, 3...)
|
1568
1071
|
|
1569
|
-
|
1072
|
+
After:
|
1570
1073
|
|
1571
|
-
|
1074
|
+
DELETE FROM `model` WHERE `model`.`parent_id` = 1
|
1572
1075
|
|
1573
|
-
*
|
1076
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
1574
1077
|
|
1575
|
-
|
1078
|
+
* Fix invalid SQL when aggregate methods (`empty?`, `any?`, `count`) used
|
1079
|
+
with `select`.
|
1576
1080
|
|
1577
|
-
|
1578
|
-
`partial_updates=`.
|
1081
|
+
Fixes #13648.
|
1579
1082
|
|
1580
|
-
*
|
1083
|
+
*Simon Woker*
|
1581
1084
|
|
1582
|
-
*
|
1085
|
+
* PostgreSQL adapter only warns once for every missing OID per connection.
|
1583
1086
|
|
1584
|
-
|
1087
|
+
Fixes #14275.
|
1585
1088
|
|
1586
|
-
*
|
1089
|
+
*Matthew Draper*, *Yves Senn*
|
1587
1090
|
|
1588
|
-
|
1091
|
+
* PostgreSQL adapter automatically reloads it's type map when encountering
|
1092
|
+
unknown OIDs.
|
1589
1093
|
|
1590
|
-
|
1094
|
+
Fixes #14678.
|
1591
1095
|
|
1592
|
-
|
1096
|
+
*Matthew Draper*, *Yves Senn*
|
1593
1097
|
|
1594
|
-
|
1595
|
-
Comment.where('posts.author_id' => 7)
|
1098
|
+
* Fix insertion of records via `has_many :through` association with scope.
|
1596
1099
|
|
1597
|
-
|
1598
|
-
Comment.references(:posts).where('posts.author_id' => 7)
|
1100
|
+
Fixes #3548.
|
1599
1101
|
|
1600
|
-
*
|
1102
|
+
*Ivan Antropov*
|
1601
1103
|
|
1602
|
-
*
|
1104
|
+
* Auto-generate stable fixture UUIDs on PostgreSQL.
|
1603
1105
|
|
1604
|
-
|
1605
|
-
default_scope -> { where published: true }
|
1606
|
-
end
|
1106
|
+
Fixes #11524.
|
1607
1107
|
|
1608
|
-
|
1609
|
-
belongs_to :post
|
1610
|
-
end
|
1108
|
+
*Roderick van Domburg*
|
1611
1109
|
|
1612
|
-
|
1613
|
-
|
1614
|
-
posts.
|
1110
|
+
* Fix a problem where an enum would overwrite values of another enum with the
|
1111
|
+
same name in an unrelated class.
|
1615
1112
|
|
1616
|
-
|
1617
|
-
so we'd get comments on unpublished posts.
|
1113
|
+
Fixes #14607.
|
1618
1114
|
|
1619
|
-
*
|
1115
|
+
*Evan Whalen*
|
1620
1116
|
|
1621
|
-
*
|
1117
|
+
* PostgreSQL and SQLite string columns no longer have a default limit of 255.
|
1622
1118
|
|
1623
|
-
|
1119
|
+
Fixes #13435, #9153.
|
1624
1120
|
|
1625
|
-
*
|
1121
|
+
*Vladimir Sazhin*, *Toms Mikoss*, *Yves Senn*
|
1626
1122
|
|
1627
|
-
|
1123
|
+
* Make possible to have an association called `records`.
|
1628
1124
|
|
1629
|
-
|
1630
|
-
can be chained with other `Enumerable` methods.
|
1125
|
+
Fixes #11645.
|
1631
1126
|
|
1632
|
-
*
|
1127
|
+
*prathamesh-sonpatki*
|
1633
1128
|
|
1634
|
-
* `
|
1635
|
-
|
1129
|
+
* `to_sql` on an association now matches the query that is actually executed, where it
|
1130
|
+
could previously have incorrectly accrued additional conditions (e.g. as a result of
|
1131
|
+
a previous query). `CollectionProxy` now always defers to the association scope's
|
1132
|
+
`arel` method so the (incorrect) inherited one should be entirely concealed.
|
1636
1133
|
|
1637
|
-
|
1134
|
+
Fixes #14003.
|
1638
1135
|
|
1639
|
-
*
|
1136
|
+
*Jefferson Lai*
|
1640
1137
|
|
1641
|
-
|
1642
|
-
By flattening the array it ensures that string values are detected
|
1643
|
-
as strings and not arrays.
|
1138
|
+
* Block a few default Class methods as scope name.
|
1644
1139
|
|
1645
|
-
|
1140
|
+
For instance, this will raise:
|
1646
1141
|
|
1647
|
-
|
1142
|
+
scope :public, -> { where(status: 1) }
|
1143
|
+
|
1144
|
+
*arthurnn*
|
1648
1145
|
|
1649
|
-
*
|
1146
|
+
* Fix error when using `with_options` with lambda.
|
1650
1147
|
|
1651
|
-
|
1652
|
-
comments for the given post to set the inverse association.
|
1148
|
+
Fixes #9805.
|
1653
1149
|
|
1654
|
-
|
1655
|
-
records and all these 100k records would be loaded in memory
|
1656
|
-
even though the comment id was supplied.
|
1150
|
+
*Lauro Caetano*
|
1657
1151
|
|
1658
|
-
|
1659
|
-
|
1152
|
+
* Switch `sqlite3:///` URLs (which were temporarily
|
1153
|
+
deprecated in 4.1) from relative to absolute.
|
1660
1154
|
|
1661
|
-
|
1155
|
+
If you still want the previous interpretation, you should replace
|
1156
|
+
`sqlite3:///my/path` with `sqlite3:my/path`.
|
1662
1157
|
|
1663
|
-
*
|
1158
|
+
*Matthew Draper*
|
1664
1159
|
|
1665
|
-
*
|
1666
|
-
new connection. This means that calling `inspect`, when the
|
1667
|
-
database is missing, will no longer raise an exception.
|
1668
|
-
Fixes #10936.
|
1160
|
+
* Treat blank UUID values as `nil`.
|
1669
1161
|
|
1670
1162
|
Example:
|
1671
1163
|
|
1672
|
-
|
1673
|
-
|
1674
|
-
*Yves Senn*
|
1164
|
+
Sample.new(uuid_field: '') #=> <Sample id: nil, uuid_field: nil>
|
1675
1165
|
|
1676
|
-
*
|
1677
|
-
Fixes #10881.
|
1166
|
+
*Dmitry Lavrov*
|
1678
1167
|
|
1679
|
-
|
1168
|
+
* Enable support for materialized views on PostgreSQL >= 9.3.
|
1680
1169
|
|
1681
|
-
*
|
1170
|
+
*Dave Lee*
|
1682
1171
|
|
1683
|
-
|
1684
|
-
`WHERE "users"."name" = 'a b'` then in the log all the
|
1685
|
-
whitespace is being squeezed. So the sql that is printed in the
|
1686
|
-
log is `WHERE "users"."name" = 'a b'`.
|
1172
|
+
* The PostgreSQL adapter supports custom domains. Fixes #14305.
|
1687
1173
|
|
1688
|
-
|
1174
|
+
*Yves Senn*
|
1689
1175
|
|
1690
|
-
|
1176
|
+
* PostgreSQL `Column#type` is now determined through the corresponding OID.
|
1177
|
+
The column types stay the same except for enum columns. They no longer have
|
1178
|
+
`nil` as type but `enum`.
|
1691
1179
|
|
1692
|
-
|
1693
|
-
This is relevant when `ENV["DATABASE_URL"]` is used in place of a `database.yml`.
|
1180
|
+
See #7814.
|
1694
1181
|
|
1695
1182
|
*Yves Senn*
|
1696
1183
|
|
1697
|
-
* Fix
|
1698
|
-
|
1184
|
+
* Fix error when specifying a non-empty default value on a PostgreSQL array
|
1185
|
+
column.
|
1699
1186
|
|
1700
|
-
|
1187
|
+
Fixes #10613.
|
1701
1188
|
|
1702
|
-
*
|
1703
|
-
For example, you need to change this:
|
1189
|
+
*Luke Steensen*
|
1704
1190
|
|
1705
|
-
|
1706
|
-
|
1707
|
-
has_many :taggings, through: :posts
|
1708
|
-
end
|
1191
|
+
* Fix error where `.persisted?` throws SystemStackError for an unsaved model with a
|
1192
|
+
custom primary key that did not save due to validation error.
|
1709
1193
|
|
1710
|
-
|
1711
|
-
has_one :tagging
|
1712
|
-
has_many :taggings
|
1713
|
-
end
|
1194
|
+
Fixes #14393.
|
1714
1195
|
|
1715
|
-
|
1716
|
-
end
|
1196
|
+
*Chris Finne*
|
1717
1197
|
|
1718
|
-
|
1198
|
+
* Introduce `validate` as an alias for `valid?`.
|
1719
1199
|
|
1720
|
-
|
1721
|
-
has_many :posts
|
1722
|
-
has_many :taggings, through: :posts, source: :tagging
|
1723
|
-
end
|
1200
|
+
This is more intuitive when you want to run validations but don't care about the return value.
|
1724
1201
|
|
1725
|
-
|
1726
|
-
has_one :tagging
|
1727
|
-
has_many :taggings
|
1728
|
-
end
|
1202
|
+
*Henrik Nyh*
|
1729
1203
|
|
1730
|
-
|
1731
|
-
end
|
1204
|
+
* Create indexes inline in CREATE TABLE for MySQL.
|
1732
1205
|
|
1733
|
-
|
1206
|
+
This is important, because adding an index on a temporary table after it has been created
|
1207
|
+
would commit the transaction.
|
1734
1208
|
|
1735
|
-
|
1736
|
-
|
1737
|
-
Fixes #5554.
|
1209
|
+
It also allows creating and dropping indexed tables with fewer queries and fewer permissions
|
1210
|
+
required.
|
1738
1211
|
|
1739
1212
|
Example:
|
1740
1213
|
|
1741
|
-
|
1742
|
-
|
1743
|
-
# After => ActiveRecord::StatementInvalid
|
1744
|
-
|
1745
|
-
# you can still use `count(:all)` to perform a query unrelated to the
|
1746
|
-
# selected columns
|
1747
|
-
User.select("name, username").count(:all) # => SELECT count(*) FROM users
|
1748
|
-
|
1749
|
-
*Yves Senn*
|
1750
|
-
|
1751
|
-
* Rails now automatically detects inverse associations. If you do not set the
|
1752
|
-
`:inverse_of` option on the association, then Active Record will guess the
|
1753
|
-
inverse association based on heuristics.
|
1754
|
-
|
1755
|
-
Note that automatic inverse detection only works on `has_many`, `has_one`,
|
1756
|
-
and `belongs_to` associations. Extra options on the associations will
|
1757
|
-
also prevent the association's inverse from being found automatically.
|
1758
|
-
|
1759
|
-
The automatic guessing of the inverse association uses a heuristic based
|
1760
|
-
on the name of the class, so it may not work for all associations,
|
1761
|
-
especially the ones with non-standard names.
|
1762
|
-
|
1763
|
-
You can turn off the automatic detection of inverse associations by setting
|
1764
|
-
the `:inverse_of` option to `false` like so:
|
1765
|
-
|
1766
|
-
class Taggable < ActiveRecord::Base
|
1767
|
-
belongs_to :tag, inverse_of: false
|
1214
|
+
create_table :temp, temporary: true, as: "SELECT id, name, zip FROM a_really_complicated_query" do |t|
|
1215
|
+
t.index :zip
|
1768
1216
|
end
|
1217
|
+
# => CREATE TEMPORARY TABLE temp (INDEX (zip)) AS SELECT id, name, zip FROM a_really_complicated_query
|
1218
|
+
|
1219
|
+
*Cody Cutrer*, *Steve Rice*, *Rafael Mendonça Franca*
|
1769
1220
|
|
1770
|
-
|
1221
|
+
* Use singular table name in generated migrations when
|
1222
|
+
`ActiveRecord::Base.pluralize_table_names` is `false`.
|
1771
1223
|
|
1772
|
-
|
1224
|
+
Fixes #13426.
|
1773
1225
|
|
1774
|
-
*
|
1226
|
+
*Kuldeep Aggarwal*
|
1775
1227
|
|
1776
|
-
*
|
1777
|
-
explicitly to mark records as `readonly.
|
1778
|
-
Fixes #10615.
|
1228
|
+
* `touch` accepts many attributes to be touched at once.
|
1779
1229
|
|
1780
1230
|
Example:
|
1781
1231
|
|
1782
|
-
|
1783
|
-
|
1784
|
-
user.save! # will raise error
|
1232
|
+
# touches :signed_at, :sealed_at, and :updated_at/on attributes.
|
1233
|
+
Photo.last.touch(:signed_at, :sealed_at)
|
1785
1234
|
|
1786
|
-
*
|
1235
|
+
*James Pinto*
|
1787
1236
|
|
1788
|
-
*
|
1237
|
+
* `rake db:structure:dump` only dumps schema information if the schema
|
1238
|
+
migration table exists.
|
1789
1239
|
|
1790
|
-
Fixes #
|
1240
|
+
Fixes #14217.
|
1791
1241
|
|
1792
1242
|
*Yves Senn*
|
1793
1243
|
|
1794
|
-
*
|
1795
|
-
|
1796
|
-
|
1244
|
+
* Reap connections that were checked out by now-dead threads, instead
|
1245
|
+
of waiting until they disconnect by themselves. Before this change,
|
1246
|
+
a suitably constructed series of short-lived threads could starve
|
1247
|
+
the connection pool, without ever having more than a couple alive at
|
1248
|
+
the same time.
|
1797
1249
|
|
1798
|
-
*
|
1250
|
+
*Matthew Draper*
|
1799
1251
|
|
1800
|
-
*
|
1252
|
+
* `pk_and_sequence_for` now ensures that only the pg_depend entries
|
1253
|
+
pointing to pg_class, and thus only sequence objects, are considered.
|
1801
1254
|
|
1802
|
-
*
|
1255
|
+
*Josh Williams*
|
1803
1256
|
|
1804
|
-
*
|
1805
|
-
as it is no longer used by internals.
|
1257
|
+
* `where.not` adds `references` for `includes` like normal `where` calls do.
|
1806
1258
|
|
1807
|
-
|
1259
|
+
Fixes #14406.
|
1808
1260
|
|
1809
|
-
*
|
1810
|
-
is not blank.
|
1261
|
+
*Yves Senn*
|
1811
1262
|
|
1812
|
-
|
1813
|
-
being picked up in `method_missing`.
|
1263
|
+
* Extend fixture `$LABEL` replacement to allow string interpolation.
|
1814
1264
|
|
1815
|
-
|
1816
|
-
table name, and calls `proper_table_name` on the arguments before sending to
|
1817
|
-
`connection`. If `table_name_prefix` or `table_name_suffix` is used, the schema
|
1818
|
-
version changes to `prefix_version_suffix`, breaking `rake test:prepare`.
|
1265
|
+
Example:
|
1819
1266
|
|
1820
|
-
|
1267
|
+
martin:
|
1268
|
+
email: $LABEL@email.com
|
1821
1269
|
|
1822
|
-
|
1270
|
+
users(:martin).email # => martin@email.com
|
1823
1271
|
|
1824
|
-
*
|
1272
|
+
*Eric Steele*
|
1825
1273
|
|
1826
|
-
|
1274
|
+
* Add support for `Relation` be passed as parameter on `QueryCache#select_all`.
|
1827
1275
|
|
1828
|
-
|
1276
|
+
Fixes #14361.
|
1829
1277
|
|
1830
|
-
*
|
1278
|
+
*arthurnn*
|
1831
1279
|
|
1832
|
-
*
|
1833
|
-
`
|
1834
|
-
causing `PredicateBuilder` to call non-existent method
|
1835
|
-
`Class#reflect_on_association`.
|
1280
|
+
* Passing an Active Record object to `find` or `exists?` is now deprecated.
|
1281
|
+
Call `.id` on the object first.
|
1836
1282
|
|
1837
|
-
*
|
1283
|
+
*Aaron Patterson*
|
1838
1284
|
|
1839
|
-
*
|
1285
|
+
* Only use BINARY for MySQL case sensitive uniqueness check when column
|
1286
|
+
has a case insensitive collation.
|
1840
1287
|
|
1841
|
-
|
1842
|
-
failing since options is an array and not a hash.
|
1288
|
+
*Ryuta Kamizono*
|
1843
1289
|
|
1844
|
-
|
1845
|
-
change_table :users do |t|
|
1846
|
-
t.remove_index [:name, :email]
|
1847
|
-
end
|
1848
|
-
end
|
1290
|
+
* Support for MySQL 5.6 fractional seconds.
|
1849
1291
|
|
1850
|
-
|
1292
|
+
*arthurnn*, *Tatsuhiko Miyagawa*
|
1851
1293
|
|
1852
|
-
|
1294
|
+
* Support for PostgreSQL `citext` data type enabling case-insensitive
|
1295
|
+
`where` values without needing to wrap in UPPER/LOWER sql functions.
|
1853
1296
|
|
1854
|
-
*
|
1297
|
+
*Troy Kruthoff*, *Lachlan Sylvester*
|
1855
1298
|
|
1856
|
-
*
|
1299
|
+
* Only save has_one associations if record has changes.
|
1300
|
+
Previously after save related callbacks, such as `#after_commit`, were triggered when the has_one
|
1301
|
+
object did not get saved to the db.
|
1857
1302
|
|
1858
|
-
|
1859
|
-
child object yourself before assignment, then the NestedAttributes
|
1860
|
-
module will not overwrite it, e.g.:
|
1303
|
+
*Alan Kennedy*
|
1861
1304
|
|
1862
|
-
|
1863
|
-
has_one :avatar
|
1864
|
-
accepts_nested_attributes_for :avatar
|
1305
|
+
* Allow strings to specify the `#order` value.
|
1865
1306
|
|
1866
|
-
|
1867
|
-
super || build_avatar(width: 200)
|
1868
|
-
end
|
1869
|
-
end
|
1307
|
+
Example:
|
1870
1308
|
|
1871
|
-
|
1872
|
-
member.avatar_attributes = {icon: 'sad'}
|
1873
|
-
member.avatar.width # => 200
|
1309
|
+
Model.order(id: 'asc').to_sql == Model.order(id: :asc).to_sql
|
1874
1310
|
|
1875
|
-
*
|
1311
|
+
*Marcelo Casiraghi*, *Robin Dupret*
|
1876
1312
|
|
1877
|
-
*
|
1878
|
-
|
1879
|
-
unique value' database error that would occur if a record being created had
|
1880
|
-
the same value on a unique indexed field as that of a record being destroyed.
|
1313
|
+
* Dynamically register PostgreSQL enum OIDs. This prevents "unknown OID"
|
1314
|
+
warnings on enum columns.
|
1881
1315
|
|
1882
|
-
*
|
1316
|
+
*Dieter Komendera*
|
1883
1317
|
|
1884
|
-
*
|
1318
|
+
* `includes` is able to detect the right preloading strategy when string
|
1319
|
+
joins are involved.
|
1885
1320
|
|
1886
|
-
|
1321
|
+
Fixes #14109.
|
1887
1322
|
|
1888
|
-
|
1323
|
+
*Aaron Patterson*, *Yves Senn*
|
1889
1324
|
|
1890
|
-
|
1891
|
-
|
1892
|
-
end
|
1325
|
+
* Fix error with validation with enum fields for records where the value for
|
1326
|
+
any enum attribute is always evaluated as 0 during uniqueness validation.
|
1893
1327
|
|
1894
|
-
|
1328
|
+
Fixes #14172.
|
1895
1329
|
|
1896
|
-
|
1330
|
+
*Vilius Luneckas* *Ahmed AbouElhamayed*
|
1897
1331
|
|
1898
|
-
|
1332
|
+
* `before_add` callbacks are fired before the record is saved on
|
1333
|
+
`has_and_belongs_to_many` associations *and* on `has_many :through`
|
1334
|
+
associations. Before this change, `before_add` callbacks would be fired
|
1335
|
+
before the record was saved on `has_and_belongs_to_many` associations, but
|
1336
|
+
*not* on `has_many :through` associations.
|
1899
1337
|
|
1900
|
-
|
1338
|
+
Fixes #14144.
|
1901
1339
|
|
1902
|
-
|
1340
|
+
* Fix STI classes not defining an attribute method if there is a conflicting
|
1341
|
+
private method defined on its ancestors.
|
1903
1342
|
|
1904
|
-
|
1343
|
+
Fixes #11569.
|
1905
1344
|
|
1906
1345
|
*Godfrey Chan*
|
1907
1346
|
|
1908
|
-
*
|
1347
|
+
* Coerce strings when reading attributes. Fixes #10485.
|
1909
1348
|
|
1910
|
-
|
1349
|
+
Example:
|
1911
1350
|
|
1912
|
-
|
1351
|
+
book = Book.new(title: 12345)
|
1352
|
+
book.save!
|
1353
|
+
book.title # => "12345"
|
1913
1354
|
|
1914
|
-
|
1355
|
+
*Yves Senn*
|
1915
1356
|
|
1916
|
-
|
1357
|
+
* Deprecate half-baked support for PostgreSQL range values with excluding beginnings.
|
1358
|
+
We currently map PostgreSQL ranges to Ruby ranges. This conversion is not fully
|
1359
|
+
possible because the Ruby range does not support excluded beginnings.
|
1917
1360
|
|
1918
|
-
|
1361
|
+
The current solution of incrementing the beginning is not correct and is now
|
1362
|
+
deprecated. For subtypes where we don't know how to increment (e.g. `#succ`
|
1363
|
+
is not defined) it will raise an `ArgumentException` for ranges with excluding
|
1364
|
+
beginnings.
|
1919
1365
|
|
1920
|
-
*
|
1366
|
+
*Yves Senn*
|
1921
1367
|
|
1922
|
-
*
|
1368
|
+
* Support for user created range types in PostgreSQL.
|
1923
1369
|
|
1924
|
-
*
|
1370
|
+
*Yves Senn*
|
1925
1371
|
|
1926
|
-
Please check [4-
|
1372
|
+
Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/activerecord/CHANGELOG.md) for previous changes.
|