activerecord 4.1.15 → 4.2.0.beta1
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 +634 -2176
- data/README.rdoc +15 -10
- data/lib/active_record/aggregations.rb +12 -8
- data/lib/active_record/associations/association.rb +1 -1
- data/lib/active_record/associations/association_scope.rb +53 -21
- data/lib/active_record/associations/belongs_to_association.rb +15 -5
- data/lib/active_record/associations/builder/association.rb +16 -5
- data/lib/active_record/associations/builder/belongs_to.rb +7 -29
- data/lib/active_record/associations/builder/has_and_belongs_to_many.rb +2 -11
- 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 +32 -44
- data/lib/active_record/associations/collection_proxy.rb +1 -10
- data/lib/active_record/associations/has_many_association.rb +60 -14
- data/lib/active_record/associations/has_many_through_association.rb +34 -23
- data/lib/active_record/associations/has_one_association.rb +0 -1
- data/lib/active_record/associations/join_dependency/join_association.rb +18 -14
- data/lib/active_record/associations/join_dependency.rb +7 -9
- data/lib/active_record/associations/preloader/association.rb +9 -5
- data/lib/active_record/associations/preloader/through_association.rb +3 -3
- data/lib/active_record/associations/preloader.rb +2 -2
- data/lib/active_record/associations/singular_association.rb +16 -1
- data/lib/active_record/associations/through_association.rb +6 -22
- data/lib/active_record/associations.rb +58 -33
- data/lib/active_record/attribute.rb +131 -0
- data/lib/active_record/attribute_assignment.rb +19 -11
- 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 +85 -42
- data/lib/active_record/attribute_methods/primary_key.rb +6 -8
- data/lib/active_record/attribute_methods/read.rb +14 -57
- data/lib/active_record/attribute_methods/serialization.rb +12 -146
- data/lib/active_record/attribute_methods/time_zone_conversion.rb +32 -40
- data/lib/active_record/attribute_methods/write.rb +8 -23
- data/lib/active_record/attribute_methods.rb +53 -90
- data/lib/active_record/attribute_set/builder.rb +32 -0
- data/lib/active_record/attribute_set.rb +77 -0
- data/lib/active_record/attributes.rb +122 -0
- data/lib/active_record/autosave_association.rb +11 -21
- data/lib/active_record/base.rb +9 -19
- data/lib/active_record/connection_adapters/abstract/connection_pool.rb +69 -45
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +22 -42
- data/lib/active_record/connection_adapters/abstract/quoting.rb +59 -60
- data/lib/active_record/connection_adapters/abstract/schema_creation.rb +37 -2
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +102 -21
- data/lib/active_record/connection_adapters/abstract/schema_dumper.rb +9 -33
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +178 -55
- data/lib/active_record/connection_adapters/abstract/transaction.rb +120 -115
- data/lib/active_record/connection_adapters/abstract_adapter.rb +143 -57
- data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +156 -107
- data/lib/active_record/connection_adapters/column.rb +13 -244
- data/lib/active_record/connection_adapters/connection_specification.rb +6 -20
- data/lib/active_record/connection_adapters/mysql2_adapter.rb +12 -15
- data/lib/active_record/connection_adapters/mysql_adapter.rb +55 -143
- 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 -20
- data/lib/active_record/connection_adapters/postgresql/oid/array.rb +96 -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 +76 -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 +85 -0
- data/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +26 -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 -388
- data/lib/active_record/connection_adapters/postgresql/quoting.rb +42 -122
- data/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +4 -4
- data/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +154 -0
- data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +86 -34
- data/lib/active_record/connection_adapters/postgresql/utils.rb +66 -0
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +188 -452
- data/lib/active_record/connection_adapters/schema_cache.rb +14 -28
- data/lib/active_record/connection_adapters/sqlite3_adapter.rb +54 -47
- data/lib/active_record/connection_handling.rb +1 -1
- data/lib/active_record/core.rb +119 -22
- data/lib/active_record/counter_cache.rb +60 -6
- data/lib/active_record/enum.rb +9 -10
- data/lib/active_record/errors.rb +27 -26
- data/lib/active_record/explain.rb +1 -1
- data/lib/active_record/fixtures.rb +52 -45
- data/lib/active_record/gem_version.rb +3 -3
- data/lib/active_record/inheritance.rb +33 -8
- data/lib/active_record/integration.rb +4 -4
- data/lib/active_record/locking/optimistic.rb +34 -16
- 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 +22 -32
- data/lib/active_record/model_schema.rb +39 -48
- data/lib/active_record/nested_attributes.rb +8 -18
- data/lib/active_record/persistence.rb +39 -22
- data/lib/active_record/query_cache.rb +3 -3
- data/lib/active_record/querying.rb +1 -8
- data/lib/active_record/railtie.rb +17 -10
- data/lib/active_record/railties/databases.rake +47 -42
- data/lib/active_record/readonly_attributes.rb +0 -1
- data/lib/active_record/reflection.rb +225 -92
- data/lib/active_record/relation/batches.rb +0 -2
- data/lib/active_record/relation/calculations.rb +28 -32
- data/lib/active_record/relation/delegation.rb +1 -1
- data/lib/active_record/relation/finder_methods.rb +42 -20
- data/lib/active_record/relation/merger.rb +0 -1
- data/lib/active_record/relation/predicate_builder/array_handler.rb +16 -11
- data/lib/active_record/relation/predicate_builder/relation_handler.rb +0 -4
- data/lib/active_record/relation/predicate_builder.rb +1 -22
- data/lib/active_record/relation/query_methods.rb +98 -62
- data/lib/active_record/relation/spawn_methods.rb +6 -7
- data/lib/active_record/relation.rb +35 -11
- data/lib/active_record/result.rb +16 -9
- data/lib/active_record/sanitization.rb +8 -1
- data/lib/active_record/schema.rb +0 -1
- data/lib/active_record/schema_dumper.rb +51 -9
- data/lib/active_record/schema_migration.rb +4 -0
- data/lib/active_record/scoping/default.rb +5 -4
- data/lib/active_record/serializers/xml_serializer.rb +3 -7
- data/lib/active_record/statement_cache.rb +79 -5
- data/lib/active_record/store.rb +5 -5
- data/lib/active_record/tasks/database_tasks.rb +37 -5
- data/lib/active_record/tasks/mysql_database_tasks.rb +1 -1
- data/lib/active_record/tasks/postgresql_database_tasks.rb +2 -2
- data/lib/active_record/timestamp.rb +9 -7
- data/lib/active_record/transactions.rb +35 -21
- data/lib/active_record/type/binary.rb +40 -0
- data/lib/active_record/type/boolean.rb +19 -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/float.rb +19 -0
- data/lib/active_record/type/hash_lookup_type_map.rb +19 -0
- data/lib/active_record/type/integer.rb +23 -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 +51 -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 +48 -0
- data/lib/active_record/type/value.rb +101 -0
- data/lib/active_record/type.rb +20 -0
- data/lib/active_record/validations/uniqueness.rb +9 -23
- data/lib/active_record/validations.rb +21 -16
- data/lib/active_record.rb +2 -1
- data/lib/rails/generators/active_record/migration/migration_generator.rb +8 -4
- data/lib/rails/generators/active_record/migration/templates/create_table_migration.rb +1 -1
- data/lib/rails/generators/active_record/model/templates/model.rb +1 -1
- metadata +71 -14
- data/lib/active_record/connection_adapters/postgresql/cast.rb +0 -168
data/CHANGELOG.md
CHANGED
@@ -1,344 +1,374 @@
|
|
1
|
-
|
1
|
+
* Fixed the `Relation#exists?` to work with polymorphic associations.
|
2
2
|
|
3
|
-
|
3
|
+
Fixes #15821.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
*Rick Song*
|
8
|
-
|
9
|
-
* No longer pass deprecated option `-i` to `pg_dump`.
|
10
|
-
|
11
|
-
*Paul Sadauskas*
|
5
|
+
*Kassio Borges*
|
12
6
|
|
7
|
+
* Currently, Active Record will rescue any errors raised within
|
8
|
+
after_rollback/after_create callbacks and print them to the logs. Next versions of rails
|
9
|
+
will not rescue those errors anymore, and just bubble them up, as the other callbacks.
|
13
10
|
|
14
|
-
|
11
|
+
This adds a opt-in flag to enable that behaviour, of not rescuing the errors.
|
12
|
+
Example:
|
15
13
|
|
16
|
-
|
14
|
+
# For not swallow errors in after_commit/after_rollback callbacks.
|
15
|
+
config.active_record.raise_in_transactional_callbacks = true
|
17
16
|
|
17
|
+
Fixes #13460.
|
18
18
|
|
19
|
-
|
19
|
+
*arthurnn*
|
20
20
|
|
21
|
-
*
|
21
|
+
* Fixed an issue where custom accessor methods (such as those generated by
|
22
|
+
`enum`) with the same name as a global method are incorrectly overridden
|
23
|
+
when subclassing.
|
22
24
|
|
25
|
+
Fixes #16288.
|
23
26
|
|
24
|
-
|
27
|
+
*Godfrey Chan*
|
25
28
|
|
26
|
-
*
|
29
|
+
* `*_was` and `changes` now work correctly for in-place attribute changes as
|
30
|
+
well.
|
27
31
|
|
28
|
-
*
|
32
|
+
*Sean Griffin*
|
29
33
|
|
30
|
-
*
|
31
|
-
only instantiates one HABTM object because the join table hasn't a primary key.
|
34
|
+
* Fix regression on after_commit that didnt fire when having nested transactions.
|
32
35
|
|
33
|
-
Fixes #
|
36
|
+
Fixes #16425
|
34
37
|
|
35
|
-
|
38
|
+
*arthurnn*
|
36
39
|
|
37
|
-
|
40
|
+
* Do not try to write timestamps when a table has no timestamps columns.
|
38
41
|
|
39
|
-
|
40
|
-
Project.includes(:salaried_developers).first.salaried_developers.size # => 1
|
42
|
+
Fixes #8813.
|
41
43
|
|
42
|
-
|
44
|
+
*Sergey Potapov*
|
43
45
|
|
44
|
-
|
45
|
-
Project.includes(:salaried_developers).first.salaried_developers.size # => 3
|
46
|
+
* `index_exists?` with `:name` option does verify specified columns.
|
46
47
|
|
47
|
-
|
48
|
+
Example:
|
48
49
|
|
50
|
+
add_index :articles, :title, name: "idx_title"
|
49
51
|
|
50
|
-
|
52
|
+
# Before:
|
53
|
+
index_exists? :articles, :title, name: "idx_title" # => `true`
|
54
|
+
index_exists? :articles, :body, name: "idx_title" # => `true`
|
51
55
|
|
52
|
-
|
53
|
-
|
56
|
+
# After:
|
57
|
+
index_exists? :articles, :title, name: "idx_title" # => `true`
|
58
|
+
index_exists? :articles, :body, name: "idx_title" # => `false`
|
54
59
|
|
55
|
-
|
60
|
+
*Yves Senn*, *Matthew Draper*
|
56
61
|
|
57
|
-
|
62
|
+
* When calling `update_columns` on a record that is not persisted, the error
|
63
|
+
message now reflects whether that object is a new record or has been
|
64
|
+
destroyed.
|
58
65
|
|
66
|
+
*Lachlan Sylvester*
|
59
67
|
|
60
|
-
|
68
|
+
* Define `id_was` to get the previous value of the primary key.
|
61
69
|
|
62
|
-
|
63
|
-
|
70
|
+
Currently when we call id_was and we have a custom primary key name
|
71
|
+
Active Record will return the current value of the primary key. This
|
72
|
+
make impossible to correctly do an update operation if you change the
|
73
|
+
id.
|
64
74
|
|
65
|
-
|
75
|
+
Fixes #16413.
|
66
76
|
|
67
|
-
*
|
68
|
-
environment. This ensures that initializers are run.
|
77
|
+
*Rafael Mendonça França*
|
69
78
|
|
70
|
-
|
79
|
+
* Deprecate `DatabaseTasks.load_schema` to act on the current connection.
|
80
|
+
Use `.load_schema_current` instead. In the future `load_schema` will
|
81
|
+
require the `configuration` to act on as an argument.
|
71
82
|
|
72
83
|
*Yves Senn*
|
73
84
|
|
74
|
-
*
|
75
|
-
|
76
|
-
Fixes #19659.
|
77
|
-
|
78
|
-
*Andrew White*
|
79
|
-
|
80
|
-
* Fix referencing wrong table aliases while joining tables of has many through
|
81
|
-
association (only when calling calculation methods).
|
82
|
-
|
83
|
-
Fixes #19276.
|
84
|
-
|
85
|
-
*pinglamb*
|
86
|
-
|
87
|
-
|
88
|
-
## Rails 4.1.11 (June 16, 2015) ##
|
85
|
+
* Fixed automatic maintaining test schema to properly handle sql structure
|
86
|
+
schema format.
|
89
87
|
|
90
|
-
|
88
|
+
Fixes #15394.
|
91
89
|
|
90
|
+
*Wojciech Wnętrzak*
|
92
91
|
|
93
|
-
|
92
|
+
* Fix type casting to Decimal from Float with large precision.
|
94
93
|
|
95
|
-
*
|
94
|
+
*Tomohiro Hashidate*
|
96
95
|
|
97
|
-
|
96
|
+
* Deprecate `Reflection#source_macro`
|
98
97
|
|
99
|
-
|
98
|
+
`Reflection#source_macro` is no longer needed in Active Record
|
99
|
+
source so it has been deprecated. Code that used `source_macro`
|
100
|
+
was removed in #16353.
|
100
101
|
|
101
|
-
*
|
102
|
-
`Comment.where(post_id: Post.none)` returned a non-empty result.
|
102
|
+
*Eileen M. Uchtitelle*, *Aaron Patterson*
|
103
103
|
|
104
|
-
|
104
|
+
* No verbose backtrace by db:drop when database does not exist.
|
105
105
|
|
106
|
-
|
106
|
+
Fixes #16295.
|
107
107
|
|
108
|
-
*
|
108
|
+
*Kenn Ejima*
|
109
109
|
|
110
|
-
|
110
|
+
* Add support for Postgresql JSONB.
|
111
111
|
|
112
|
-
|
112
|
+
Example:
|
113
113
|
|
114
|
-
|
114
|
+
create_table :posts do |t|
|
115
|
+
t.jsonb :meta_data
|
116
|
+
end
|
115
117
|
|
116
|
-
|
117
|
-
Property.group(:value).count
|
118
|
+
*Philippe Creux*, *Chris Teague*
|
118
119
|
|
119
|
-
|
120
|
+
* `db:purge` with MySQL respects `Rails.env`.
|
120
121
|
|
121
|
-
*
|
122
|
+
*Yves Senn*
|
122
123
|
|
123
|
-
|
124
|
+
* `change_column_default :table, :column, nil` with PostgreSQL will issue a
|
125
|
+
`DROP DEFAULT` instead of a `DEFAULT NULL` query.
|
124
126
|
|
125
|
-
|
127
|
+
Fixes #16261.
|
126
128
|
|
127
|
-
*
|
129
|
+
*Matthew Draper*, *Yves Senn*
|
128
130
|
|
129
|
-
|
131
|
+
* Allow to specify a type for the foreign key column in `references`
|
132
|
+
and `add_reference`.
|
130
133
|
|
131
|
-
|
134
|
+
Example:
|
132
135
|
|
133
|
-
|
136
|
+
change_table :vehicle do |t|
|
137
|
+
t.references :station, type: :uuid
|
138
|
+
end
|
134
139
|
|
135
|
-
*
|
140
|
+
*Andrey Novikov*, *Łukasz Sarnacki*
|
136
141
|
|
142
|
+
* `create_join_table` removes a common prefix when generating the join table.
|
143
|
+
This matches the existing behavior of HABTM associations.
|
137
144
|
|
138
|
-
|
145
|
+
Fixes #13683.
|
139
146
|
|
140
|
-
*
|
141
|
-
before loading the schema. This is left for the user to do.
|
142
|
-
`db:test:prepare` will still purge the database.
|
147
|
+
*Stefan Kanev*
|
143
148
|
|
144
|
-
|
149
|
+
* Dont swallow errors on compute_type when having a bad alias_method on
|
150
|
+
a class.
|
145
151
|
|
146
|
-
*
|
152
|
+
*arthurnn*
|
147
153
|
|
148
|
-
*
|
154
|
+
* PostgreSQL invalid `uuid` are convert to nil.
|
149
155
|
|
150
|
-
|
151
|
-
when a migration is rolled-back, edited and reapplied.
|
156
|
+
*Abdelkader Boudih*
|
152
157
|
|
153
|
-
|
154
|
-
to synchronize the schema. Plugins can use this task as a hook to
|
155
|
-
provide custom behavior after the schema has been loaded.
|
158
|
+
* Restore 4.0 behavior for using serialize attributes with `JSON` as coder.
|
156
159
|
|
157
|
-
|
160
|
+
With 4.1.x, `serialize` started returning a string when `JSON` was passed as
|
161
|
+
the second attribute. It will now return a hash as per previous versions.
|
158
162
|
|
159
|
-
|
163
|
+
Example:
|
160
164
|
|
161
|
-
|
165
|
+
class Post < ActiveRecord::Base
|
166
|
+
serialize :comment, JSON
|
167
|
+
end
|
162
168
|
|
163
|
-
|
169
|
+
class Comment
|
170
|
+
include ActiveModel::Model
|
171
|
+
attr_accessor :category, :text
|
172
|
+
end
|
164
173
|
|
165
|
-
|
174
|
+
post = Post.create!
|
175
|
+
post.comment = Comment.new(category: "Animals", text: "This is a comment about squirrels.")
|
176
|
+
post.save!
|
166
177
|
|
167
|
-
|
178
|
+
# 4.0
|
179
|
+
post.comment # => {"category"=>"Animals", "text"=>"This is a comment about squirrels."}
|
168
180
|
|
169
|
-
|
181
|
+
# 4.1 before
|
182
|
+
post.comment # => "#<Comment:0x007f80ab48ff98>"
|
170
183
|
|
171
|
-
|
184
|
+
# 4.1 after
|
185
|
+
post.comment # => {"category"=>"Animals", "text"=>"This is a comment about squirrels."}
|
172
186
|
|
173
|
-
|
174
|
-
|
187
|
+
When using `JSON` as the coder in `serialize`, Active Record will use the
|
188
|
+
new `ActiveRecord::Coders::JSON` coder which delegates its `dump/load` to
|
189
|
+
`ActiveSupport::JSON.encode/decode`. This ensures special objects are dumped
|
190
|
+
correctly using the `#as_json` hook.
|
175
191
|
|
176
|
-
|
192
|
+
To keep the previous behaviour, supply a custom coder instead
|
193
|
+
([example](https://gist.github.com/jenncoop/8c4142bbe59da77daa63)).
|
177
194
|
|
178
|
-
|
195
|
+
Fixes #15594.
|
179
196
|
|
197
|
+
*Jenn Cooper*
|
180
198
|
|
181
|
-
|
199
|
+
* Do not use `RENAME INDEX` syntax for MariaDB 10.0.
|
182
200
|
|
183
|
-
|
184
|
-
the owner has been saved so that the proxy is not cached without the
|
185
|
-
owner's id.
|
201
|
+
Fixes #15931.
|
186
202
|
|
187
|
-
*
|
203
|
+
*Jeff Browning*
|
188
204
|
|
189
|
-
*
|
205
|
+
* Calling `#empty?` on a `has_many` association would use the value from the
|
206
|
+
counter cache if one exists.
|
190
207
|
|
191
|
-
|
208
|
+
*David Verhasselt*
|
192
209
|
|
193
|
-
|
210
|
+
* Fix the schema dump generated for tables without constraints and with
|
211
|
+
primary key with default value of custom PostgreSQL function result.
|
194
212
|
|
195
|
-
|
213
|
+
Fixes #16111.
|
196
214
|
|
197
|
-
|
215
|
+
*Andrey Novikov*
|
198
216
|
|
199
|
-
|
217
|
+
* Fix the SQL generated when a `delete_all` is run on an association to not
|
218
|
+
produce an `IN` statements.
|
200
219
|
|
201
|
-
|
220
|
+
Before:
|
202
221
|
|
203
|
-
|
222
|
+
UPDATE "categorizations" SET "category_id" = NULL WHERE
|
223
|
+
"categorizations"."category_id" = 1 AND "categorizations"."id" IN (1, 2)
|
204
224
|
|
205
|
-
|
225
|
+
After:
|
206
226
|
|
207
|
-
|
208
|
-
|
227
|
+
UPDATE "categorizations" SET "category_id" = NULL WHERE
|
228
|
+
"categorizations"."category_id" = 1
|
209
229
|
|
210
|
-
|
230
|
+
*Eileen M. Uchitelle, Aaron Patterson*
|
211
231
|
|
212
|
-
|
232
|
+
* Avoid type casting boolean and ActiveSupport::Duration values to numeric
|
233
|
+
values for string columns. Otherwise, in some database, the string column
|
234
|
+
values will be coerced to a numeric allowing false or 0.seconds match any
|
235
|
+
string starting with a non-digit.
|
213
236
|
|
214
|
-
|
237
|
+
Example:
|
215
238
|
|
216
|
-
|
239
|
+
App.where(apikey: false) # => SELECT * FROM users WHERE apikey = '0'
|
217
240
|
|
218
|
-
*
|
219
|
-
schema format.
|
241
|
+
*Dylan Thacker-Smith*
|
220
242
|
|
221
|
-
|
243
|
+
* Add a `:required` option to singular associations, providing a nicer
|
244
|
+
API for presence validations on associations.
|
222
245
|
|
223
|
-
*
|
246
|
+
*Sean Griffin*
|
224
247
|
|
225
|
-
*
|
226
|
-
|
248
|
+
* Fixed error in `reset_counters` when associations have `select` scope.
|
249
|
+
(Call to `count` generates invalid SQL.)
|
227
250
|
|
228
|
-
|
251
|
+
*Cade Truitt*
|
229
252
|
|
230
|
-
|
253
|
+
* After a successful `reload`, `new_record?` is always false.
|
231
254
|
|
255
|
+
Fixes #12101.
|
232
256
|
|
233
|
-
|
257
|
+
*Matthew Draper*
|
234
258
|
|
235
|
-
*
|
259
|
+
* PostgreSQL renaming table doesn't attempt to rename non existent sequences.
|
236
260
|
|
261
|
+
*Abdelkader Boudih*
|
237
262
|
|
238
|
-
|
263
|
+
* Move 'dependent: :destroy' handling for 'belongs_to'
|
264
|
+
from 'before_destroy' to 'after_destroy' callback chain
|
239
265
|
|
240
|
-
|
266
|
+
Fixes #12380.
|
241
267
|
|
268
|
+
*Ivan Antropov*
|
242
269
|
|
243
|
-
|
270
|
+
* Detect in-place modifications on String attributes.
|
244
271
|
|
245
|
-
|
246
|
-
|
272
|
+
Before this change user have to mark the attribute as changed to it be persisted
|
273
|
+
in the database. Now it is not required anymore.
|
247
274
|
|
248
|
-
|
275
|
+
Before:
|
249
276
|
|
250
|
-
|
277
|
+
user = User.first
|
278
|
+
user.name << ' Griffin'
|
279
|
+
user.name_will_change!
|
280
|
+
user.save
|
281
|
+
user.reload.name # => "Sean Griffin"
|
251
282
|
|
252
|
-
|
253
|
-
`enum`) with the same name as a global method are incorrectly overridden
|
254
|
-
when subclassing.
|
283
|
+
After:
|
255
284
|
|
256
|
-
|
285
|
+
user = User.first
|
286
|
+
user.name << ' Griffin'
|
287
|
+
user.save
|
288
|
+
user.reload.name # => "Sean Griffin"
|
257
289
|
|
258
|
-
*
|
290
|
+
*Sean Griffin*
|
259
291
|
|
260
|
-
|
261
|
-
|
292
|
+
* Add `ActiveRecord::Base#validate!` that raises `RecordInvalid` if the record
|
293
|
+
is invalid.
|
262
294
|
|
263
|
-
|
295
|
+
*Bogdan Gusiev*, *Marc Schütz*
|
264
296
|
|
265
|
-
|
297
|
+
* Support for adding and removing foreign keys. Foreign keys are now
|
298
|
+
a part of `schema.rb`. This is supported by Mysql2Adapter, MysqlAdapter
|
299
|
+
and PostgreSQLAdapter.
|
266
300
|
|
267
|
-
*
|
301
|
+
Many thanks to *Matthew Higgins* for laying the foundation with his work on
|
302
|
+
[foreigner](https://github.com/matthuhiggins/foreigner).
|
268
303
|
|
269
|
-
|
304
|
+
Example:
|
270
305
|
|
271
|
-
|
306
|
+
# within your migrations:
|
307
|
+
add_foreign_key :articles, :authors
|
308
|
+
remove_foreign_key :articles, :authors
|
272
309
|
|
273
|
-
*
|
310
|
+
*Yves Senn*
|
274
311
|
|
275
|
-
|
276
|
-
|
277
|
-
make impossible to correctly do an update operation if you change the
|
278
|
-
id.
|
312
|
+
* Fix subtle bugs regarding attribute assignment on models with no primary
|
313
|
+
key. `'id'` will no longer be part of the attributes hash.
|
279
314
|
|
280
|
-
|
315
|
+
*Sean Griffin*
|
281
316
|
|
282
|
-
|
317
|
+
* Deprecate automatic counter caches on `has_many :through`. The behavior was
|
318
|
+
broken and inconsistent.
|
283
319
|
|
284
|
-
*
|
285
|
-
primary key with default value of custom PostgreSQL function result.
|
320
|
+
*Sean Griffin*
|
286
321
|
|
287
|
-
|
322
|
+
* `preload` preserves readonly flag for associations.
|
288
323
|
|
289
|
-
|
324
|
+
See #15853.
|
290
325
|
|
291
|
-
*
|
326
|
+
*Yves Senn*
|
292
327
|
|
293
|
-
|
294
|
-
|
328
|
+
* Assume numeric types have changed if they were assigned to a value that
|
329
|
+
would fail numericality validation, regardless of the old value. Previously
|
330
|
+
this would only occur if the old value was 0.
|
295
331
|
|
296
332
|
Example:
|
297
333
|
|
298
|
-
|
299
|
-
|
300
|
-
|
334
|
+
model = Model.create!(number: 5)
|
335
|
+
model.number = '5wibble'
|
336
|
+
model.number_changed? # => true
|
301
337
|
|
302
|
-
|
303
|
-
include ActiveModel::Model
|
304
|
-
attr_accessor :category, :text
|
305
|
-
end
|
338
|
+
Fixes #14731.
|
306
339
|
|
307
|
-
|
308
|
-
post.comment = Comment.new(category: "Animals", text: "This is a comment about squirrels.")
|
309
|
-
post.save!
|
340
|
+
*Sean Griffin*
|
310
341
|
|
311
|
-
|
312
|
-
|
342
|
+
* `reload` no longer merges with the existing attributes.
|
343
|
+
The attribute hash is fully replaced. The record is put into the same state
|
344
|
+
as it would be with `Model.find(model.id)`.
|
313
345
|
|
314
|
-
|
315
|
-
post.comment # => "#<Comment:0x007f80ab48ff98>"
|
346
|
+
*Sean Griffin*
|
316
347
|
|
317
|
-
|
318
|
-
|
348
|
+
* The object returned from `select_all` must respond to `column_types`.
|
349
|
+
If this is not the case a `NoMethodError` is raised.
|
319
350
|
|
320
|
-
|
321
|
-
new `ActiveRecord::Coders::JSON` coder which delegates its `dump/load` to
|
322
|
-
`ActiveSupport::JSON.encode/decode`. This ensures special objects are dumped
|
323
|
-
correctly using the `#as_json` hook.
|
351
|
+
*Sean Griffin*
|
324
352
|
|
325
|
-
|
326
|
-
|
353
|
+
* `has_many :through` associations will no longer save the through record
|
354
|
+
twice when added in an `after_create` callback defined before the
|
355
|
+
associations.
|
327
356
|
|
328
|
-
Fixes #
|
357
|
+
Fixes #3798.
|
329
358
|
|
330
|
-
*
|
359
|
+
*Sean Griffin*
|
331
360
|
|
332
|
-
*
|
333
|
-
(Call to `count` generates invalid SQL.)
|
361
|
+
* Detect in-place modifications of PG array types
|
334
362
|
|
335
|
-
*
|
363
|
+
*Sean Griffin*
|
336
364
|
|
337
|
-
*
|
365
|
+
* Add `bin/rake db:purge` task to empty the current database.
|
338
366
|
|
339
|
-
|
367
|
+
*Yves Senn*
|
340
368
|
|
341
|
-
|
369
|
+
* Deprecate `serialized_attributes` without replacement.
|
370
|
+
|
371
|
+
*Sean Griffin*
|
342
372
|
|
343
373
|
* Correctly extract IPv6 addresses from `DATABASE_URI`: the square brackets
|
344
374
|
are part of the URI structure, not the actual host.
|
@@ -347,14 +377,16 @@
|
|
347
377
|
|
348
378
|
*Andy Bakun*, *Aaron Stone*
|
349
379
|
|
350
|
-
*
|
351
|
-
|
352
|
-
Fixes #15697.
|
380
|
+
* Ensure both parent IDs are set on join records when both sides of a
|
381
|
+
through association are new.
|
353
382
|
|
354
383
|
*Sean Griffin*
|
355
384
|
|
356
|
-
*
|
357
|
-
|
385
|
+
* `ActiveRecord::Dirty` now detects in-place changes to mutable values.
|
386
|
+
Serialized attributes on ActiveRecord models will no longer save when
|
387
|
+
unchanged.
|
388
|
+
|
389
|
+
Fixes #8328.
|
358
390
|
|
359
391
|
*Sean Griffin*
|
360
392
|
|
@@ -365,6 +397,14 @@
|
|
365
397
|
|
366
398
|
*Sean Griffin*
|
367
399
|
|
400
|
+
* Remove `cache_attributes` and friends. All attributes are cached.
|
401
|
+
|
402
|
+
*Sean Griffin*
|
403
|
+
|
404
|
+
* Remove deprecated method `ActiveRecord::Base.quoted_locking_column`.
|
405
|
+
|
406
|
+
*Akshay Vishnoi*
|
407
|
+
|
368
408
|
* `ActiveRecord::FinderMethods.find` with block can handle proc parameter as
|
369
409
|
`Enumerable#find` does.
|
370
410
|
|
@@ -372,6 +412,12 @@
|
|
372
412
|
|
373
413
|
*James Yang*
|
374
414
|
|
415
|
+
* Make timezone aware attributes work with PostgreSQL array columns.
|
416
|
+
|
417
|
+
Fixes #13402.
|
418
|
+
|
419
|
+
*Kuldeep Aggarwal*, *Sean Griffin*
|
420
|
+
|
375
421
|
* `ActiveRecord::SchemaMigration` has no primary key regardless of the
|
376
422
|
`primary_key_prefix_type` configuration.
|
377
423
|
|
@@ -385,52 +431,72 @@
|
|
385
431
|
|
386
432
|
*Yves Senn*
|
387
433
|
|
388
|
-
*
|
389
|
-
with orders without sort direction modifiers.
|
434
|
+
* Baseclass becomes! subclass.
|
390
435
|
|
391
|
-
|
436
|
+
Before this change, a record which changed its STI type, could not be
|
437
|
+
updated.
|
392
438
|
|
393
|
-
|
394
|
-
Fixes duplication in combination with `store_accessor`.
|
439
|
+
Fixes #14785.
|
395
440
|
|
396
|
-
|
441
|
+
*Matthew Draper*, *Earl St Sauver*, *Edo Balvers*
|
397
442
|
|
398
|
-
|
443
|
+
* Remove deprecated `ActiveRecord::Migrator.proper_table_name`. Use the
|
444
|
+
`proper_table_name` instance method on `ActiveRecord::Migration` instead.
|
399
445
|
|
400
|
-
*
|
446
|
+
*Akshay Vishnoi*
|
401
447
|
|
402
|
-
|
448
|
+
* Fix regression on eager loading association based on SQL query rather than
|
449
|
+
existing column.
|
450
|
+
|
451
|
+
Fixes #15480.
|
403
452
|
|
453
|
+
*Lauro Caetano*, *Carlos Antonio da Silva*
|
404
454
|
|
405
|
-
|
455
|
+
* Deprecate returning `nil` from `column_for_attribute` when no column exists.
|
456
|
+
It will return a null object in Rails 5.0
|
406
457
|
|
407
|
-
*
|
458
|
+
*Sean Griffin*
|
408
459
|
|
460
|
+
* Implemented ActiveRecord::Base#pretty_print to work with PP.
|
409
461
|
|
410
|
-
|
462
|
+
*Ethan*
|
411
463
|
|
412
|
-
*
|
464
|
+
* Preserve type when dumping PostgreSQL point, bit, bit varying and money
|
465
|
+
columns.
|
413
466
|
|
414
|
-
*
|
467
|
+
*Yves Senn*
|
415
468
|
|
469
|
+
* New records remain new after YAML serialization.
|
416
470
|
|
417
|
-
|
471
|
+
*Sean Griffin*
|
418
472
|
|
419
|
-
*
|
473
|
+
* PostgreSQL support default values for enum types. Fixes #7814.
|
420
474
|
|
421
|
-
|
475
|
+
*Yves Senn*
|
422
476
|
|
423
|
-
|
477
|
+
* PostgreSQL `default_sequence_name` respects schema. Fixes #7516.
|
424
478
|
|
479
|
+
*Yves Senn*
|
425
480
|
|
426
|
-
|
481
|
+
* Fixed `columns_for_distinct` of postgresql adapter to work correctly
|
482
|
+
with orders without sort direction modifiers.
|
427
483
|
|
428
|
-
*
|
429
|
-
existing column.
|
484
|
+
*Nikolay Kondratyev*
|
430
485
|
|
431
|
-
|
486
|
+
* PostgreSQL `reset_pk_sequence!` respects schemas. Fixes #14719.
|
432
487
|
|
433
|
-
*
|
488
|
+
*Yves Senn*
|
489
|
+
|
490
|
+
* Keep PostgreSQL `hstore` and `json` attributes as `Hash` in `@attributes`.
|
491
|
+
Fixes duplication in combination with `store_accessor`.
|
492
|
+
|
493
|
+
Fixes #15369.
|
494
|
+
|
495
|
+
*Yves Senn*
|
496
|
+
|
497
|
+
* `rake railties:install:migrations` respects the order of railties.
|
498
|
+
|
499
|
+
*Arun Agrawal*
|
434
500
|
|
435
501
|
* Fix redefine a has_and_belongs_to_many inside inherited class
|
436
502
|
Fixing regression case, where redefining the same has_an_belongs_to_many
|
@@ -454,2220 +520,612 @@
|
|
454
520
|
|
455
521
|
*Godfrey Chan*
|
456
522
|
|
457
|
-
* Fixed serialized fields returning serialized data after being updated with
|
458
|
-
`update_column`.
|
459
|
-
|
460
|
-
*Simon Hørup Eskildsen*
|
461
|
-
|
462
523
|
* When a `group` is set, `sum`, `size`, `average`, `minimum` and `maximum`
|
463
524
|
on a NullRelation should return a Hash.
|
464
525
|
|
465
526
|
*Kuldeep Aggarwal*
|
466
527
|
|
467
|
-
* Fixed
|
468
|
-
|
469
|
-
Fixes #14734.
|
470
|
-
|
471
|
-
*Lauro Caetano*
|
472
|
-
|
473
|
-
* Fixed the inferred table name of a has_and_belongs_to_many auxiliar
|
474
|
-
table inside a schema.
|
475
|
-
|
476
|
-
Fixes #14824
|
477
|
-
|
478
|
-
*Eric Chahin*
|
479
|
-
|
480
|
-
* Fix bug that added `table_name_prefix` and `table_name_suffix` to
|
481
|
-
extension names in PostgreSQL when migrating.
|
482
|
-
|
483
|
-
*Joao Carlos*
|
484
|
-
|
485
|
-
* Floats with limit >= 25 that get turned into doubles in MySQL no longer have
|
486
|
-
their limit dropped from the schema.
|
487
|
-
|
488
|
-
Fixes #14135.
|
489
|
-
|
490
|
-
*Aaron Nelson*
|
491
|
-
|
492
|
-
* Fix how to calculate associated class name when using namespaced has_and_belongs_to_many
|
493
|
-
association.
|
494
|
-
|
495
|
-
Fixes #14709.
|
496
|
-
|
497
|
-
*Kassio Borges*
|
498
|
-
|
499
|
-
* `ActiveRecord::Relation::Merger#filter_binds` now compares equivalent symbols and
|
500
|
-
strings in column names as equal.
|
501
|
-
|
502
|
-
This fixes a rare case in which more bind values are passed than there are
|
503
|
-
placeholders for them in the generated SQL statement, which can make PostgreSQL
|
504
|
-
throw a `StatementInvalid` exception.
|
505
|
-
|
506
|
-
*Nat Budin*
|
507
|
-
|
508
|
-
* Fix `stored_attributes` to correctly merge the details of stored
|
509
|
-
attributes defined in parent classes.
|
510
|
-
|
511
|
-
Fixes #14672.
|
512
|
-
|
513
|
-
*Brad Bennett*, *Jessica Yao*, *Lakshmi Parthasarathy*
|
514
|
-
|
515
|
-
* `change_column_default` allows `[]` as argument to `change_column_default`.
|
516
|
-
|
517
|
-
Fixes #11586.
|
518
|
-
|
519
|
-
*Yves Senn*
|
520
|
-
|
521
|
-
* Fix `PostgreSQLAdapter::OID::Float#type_cast` to convert Infinity and
|
522
|
-
NaN PostgreSQL values into a native Ruby `Float::INFINITY` and `Float::NAN`
|
523
|
-
|
524
|
-
Example:
|
525
|
-
|
526
|
-
# Before
|
527
|
-
Point.create(value: 1.0/0)
|
528
|
-
Point.last.value # => 0.0
|
529
|
-
|
530
|
-
# After
|
531
|
-
Point.create(value: 1.0/0)
|
532
|
-
Point.last.value # => Infinity
|
533
|
-
|
534
|
-
*Innokenty Mikhailov*
|
535
|
-
|
536
|
-
* Allow the PostgreSQL adapter to handle bigserial primary key types again.
|
537
|
-
|
538
|
-
Fixes #10410.
|
539
|
-
|
540
|
-
*Patrick Robertson*
|
541
|
-
|
542
|
-
* Fixed has_and_belongs_to_many's CollectionAssociation size calculation.
|
543
|
-
|
544
|
-
has_and_belongs_to_many should fall back to using the normal CollectionAssociation's
|
545
|
-
size calculation if the collection is not cached or loaded.
|
546
|
-
|
547
|
-
Fixes #14913 and #14914.
|
548
|
-
|
549
|
-
*Fred Wu*
|
550
|
-
|
551
|
-
* Revert the behaviour of `ActiveRecord::Relation#join` changed through 4.0 => 4.1 to 4.0.
|
552
|
-
|
553
|
-
In 4.1.0 `Relation#join` is delegated to `Arel#SelectManager`.
|
554
|
-
In 4.0 series it is delegated to `Array#join`.
|
555
|
-
|
556
|
-
*Bogdan Gusiev*
|
557
|
-
|
558
|
-
* Log nil binary column values correctly.
|
559
|
-
|
560
|
-
When an object with a binary column is updated with a nil value
|
561
|
-
in that column, the SQL logger would throw an exception when trying
|
562
|
-
to log that nil value. This only occurs when updating a record
|
563
|
-
that already has a non-nil value in that column since an initial nil
|
564
|
-
value isn't included in the SQL anyway (at least, when dirty checking
|
565
|
-
is enabled.) The column's new value will now be logged as `<NULL binary data>`
|
566
|
-
to parallel the existing `<N bytes of binary data>` for non-nil values.
|
567
|
-
|
568
|
-
*James Coleman*
|
569
|
-
|
570
|
-
* Stringify all variables keys of MySQL connection configuration.
|
571
|
-
|
572
|
-
When `sql_mode` variable for MySQL adapters set in configuration as `String`
|
573
|
-
was ignored and overwritten by strict mode option.
|
574
|
-
|
575
|
-
Fixes #14895.
|
576
|
-
|
577
|
-
*Paul Nikitochkin*
|
578
|
-
|
579
|
-
* Ensure SQLite3 statements are closed on errors.
|
580
|
-
|
581
|
-
Fixes #13631.
|
582
|
-
|
583
|
-
*Timur Alperovich*
|
584
|
-
|
585
|
-
* Fix excluding lower bounds of PostgreSQL date and int ranges.
|
586
|
-
|
587
|
-
*River MacLeod*, *Yves Senn*
|
588
|
-
|
589
|
-
* When using a custom `join_table` name on a `habtm`, rails was not saving it
|
590
|
-
on Reflections. This causes a problem when rails loads fixtures, because it
|
591
|
-
uses the reflections to set database with fixtures.
|
592
|
-
|
593
|
-
Fixes #14845.
|
594
|
-
|
595
|
-
*Kassio Borges*
|
596
|
-
|
597
|
-
* `ActiveRecord::Base.no_touching` no longer triggers callbacks or start empty transactions.
|
598
|
-
|
599
|
-
Fixes #14841.
|
600
|
-
|
601
|
-
*Lucas Mazza*
|
602
|
-
|
603
|
-
* Fix name collision with `Array#select!` with `Relation#select!`.
|
604
|
-
|
605
|
-
Fixes #14752.
|
606
|
-
|
607
|
-
*Earl St Sauver*
|
608
|
-
|
609
|
-
* Fixed unexpected behavior for `has_many :through` associations going through a scoped `has_many`.
|
610
|
-
|
611
|
-
If a `has_many` association is adjusted using a scope, and another `has_many :through`
|
612
|
-
uses this association, then the scope adjustment is unexpectedly neglected.
|
613
|
-
|
614
|
-
Fixes #14537.
|
615
|
-
|
616
|
-
*Jan Habermann*
|
617
|
-
|
618
|
-
* When a destroyed record is duped, the dup is not `destroyed?`.
|
619
|
-
|
620
|
-
*Kuldeep Aggarwal*
|
621
|
-
|
622
|
-
* Fixed has_many association to make it support irregular inflections.
|
623
|
-
|
624
|
-
Fixes #8928.
|
625
|
-
|
626
|
-
*arthurnn*, *Javier Goizueta*
|
627
|
-
|
628
|
-
* Calling `delete_all` on an unloaded `CollectionProxy` no longer
|
629
|
-
generates a SQL statement containing each id of the collection:
|
630
|
-
|
631
|
-
Before:
|
632
|
-
|
633
|
-
DELETE FROM `model` WHERE `model`.`parent_id` = 1
|
634
|
-
AND `model`.`id` IN (1, 2, 3...)
|
635
|
-
|
636
|
-
After:
|
637
|
-
|
638
|
-
DELETE FROM `model` WHERE `model`.`parent_id` = 1
|
639
|
-
|
640
|
-
*Eileen M. Uchitelle*, *Aaron Patterson*
|
641
|
-
|
642
|
-
* Fixed a problem where count used with a grouping was not returning a Hash.
|
643
|
-
|
644
|
-
Fixes #14721.
|
645
|
-
|
646
|
-
*Eric Chahin*
|
647
|
-
|
648
|
-
* Do not quote uuid default value on `change_column`.
|
649
|
-
|
650
|
-
Fixes #14604.
|
651
|
-
|
652
|
-
*Eric Chahin*
|
653
|
-
|
654
|
-
* The comparison between `Relation` and `CollectionProxy` should be consistent.
|
655
|
-
|
656
|
-
Example:
|
657
|
-
|
658
|
-
author.posts == Post.where(author_id: author.id)
|
659
|
-
# => true
|
660
|
-
Post.where(author_id: author.id) == author.posts
|
661
|
-
# => true
|
662
|
-
|
663
|
-
Fixes #13506.
|
664
|
-
|
665
|
-
*Lauro Caetano*
|
666
|
-
|
667
|
-
* PostgreSQL adapter only warns once for every missing OID per connection.
|
668
|
-
|
669
|
-
Fixes #14275.
|
670
|
-
|
671
|
-
*Matthew Draper*, *Yves Senn*
|
672
|
-
|
673
|
-
* Fixed error for aggregate methods (`empty?`, `any?`, `count`) with `select`
|
674
|
-
which created invalid SQL.
|
675
|
-
|
676
|
-
Fixes #13648.
|
677
|
-
|
678
|
-
*Simon Woker*
|
679
|
-
|
680
|
-
* Fix insertion of records via `has_many :through` association with scope.
|
681
|
-
|
682
|
-
Fixes #3548.
|
683
|
-
|
684
|
-
*Ivan Antropov*
|
685
|
-
|
686
|
-
* Make possible to have an association called `records`.
|
687
|
-
|
688
|
-
Fixes #11645.
|
689
|
-
|
690
|
-
*prathamesh-sonpatki*
|
691
|
-
|
692
|
-
* `to_sql` on an association now matches the query that is actually executed, where it
|
693
|
-
could previously have incorrectly accrued additional conditions (e.g. as a result of
|
694
|
-
a previous query). CollectionProxy now always defers to the association scope's
|
695
|
-
`arel` method so the (incorrect) inherited one should be entirely concealed.
|
696
|
-
|
697
|
-
Fixes #14003.
|
698
|
-
|
699
|
-
*Jefferson Lai*
|
700
|
-
|
701
|
-
* Fixed error when using `with_options` with lambda.
|
702
|
-
|
703
|
-
Fixes #9805.
|
704
|
-
|
705
|
-
*Lauro Caetano*
|
706
|
-
|
707
|
-
* Fixed error when specifying a non-empty default value on a PostgreSQL array column.
|
708
|
-
|
709
|
-
Fixes #10613.
|
710
|
-
|
711
|
-
*Luke Steensen*
|
712
|
-
|
713
|
-
* Fixed error where .persisted? throws SystemStackError for an unsaved model with a
|
714
|
-
custom primary key that didn't save due to validation error.
|
715
|
-
|
716
|
-
Fixes #14393.
|
717
|
-
|
718
|
-
*Chris Finne*
|
719
|
-
|
720
|
-
* `rake db:structure:dump` only dumps schema information if the schema
|
721
|
-
migration table exists.
|
722
|
-
|
723
|
-
Fixes #14217.
|
724
|
-
|
725
|
-
*Yves Senn*
|
726
|
-
|
727
|
-
* Add support for `Relation` be passed as parameter on `QueryCache#select_all`.
|
728
|
-
|
729
|
-
Fixes #14361.
|
730
|
-
|
731
|
-
*arthurnn*
|
732
|
-
|
733
|
-
* Only save `has_one` associations if record has changes. Previously after save
|
734
|
-
related callbacks, such as `#after_commit`, were triggered when the
|
735
|
-
`has_one` object did not get saved to the db.
|
736
|
-
|
737
|
-
*Alan Kennedy*
|
738
|
-
|
739
|
-
|
740
|
-
## Rails 4.1.1 (May 6, 2014) ##
|
741
|
-
|
742
|
-
* No changes.
|
743
|
-
|
744
|
-
|
745
|
-
## Rails 4.1.0 (April 8, 2014) ##
|
746
|
-
|
747
|
-
* Fixed a problem where an enum would overwrite values of another enum
|
748
|
-
with the same name in an unrelated class.
|
749
|
-
|
750
|
-
Fixes #14607.
|
751
|
-
|
752
|
-
*Evan Whalen*
|
753
|
-
|
754
|
-
|
755
|
-
* Block a few default Class methods as scope name.
|
756
|
-
|
757
|
-
For instance, this will raise:
|
758
|
-
|
759
|
-
scope :public, -> { where(status: 1) }
|
760
|
-
|
761
|
-
*arthurnn*
|
762
|
-
|
763
|
-
* Deprecate SQLite database URLs containing an
|
764
|
-
authority.
|
765
|
-
|
766
|
-
The current "correct" spellings for in-memory, relative, and
|
767
|
-
absolute URLs, respectively, are:
|
768
|
-
|
769
|
-
sqlite3::memory:
|
770
|
-
sqlite3:relative/path
|
771
|
-
sqlite3:/full/path
|
772
|
-
|
773
|
-
The previous spelling (`sqlite3:///relative/path`) continues to work
|
774
|
-
as it did in Rails 4.0, but with a deprecation warning: in the next
|
775
|
-
release, that spelling will instead be interpreted as an absolute
|
776
|
-
path.
|
777
|
-
|
778
|
-
*Matthew Draper*
|
779
|
-
|
780
|
-
* `where.not` adds `references` for `includes` like normal `where` calls do.
|
781
|
-
|
782
|
-
Fixes #14406.
|
783
|
-
|
784
|
-
*Yves Senn*
|
785
|
-
|
786
|
-
* `includes` is able to detect the right preloading strategy when string
|
787
|
-
joins are involved.
|
788
|
-
|
789
|
-
Fixes #14109.
|
790
|
-
|
791
|
-
*Aaron Patterson*, *Yves Senn*
|
792
|
-
|
793
|
-
* Fixed error with validation with enum fields for records where the
|
794
|
-
value for any enum attribute is always evaluated as 0 during
|
795
|
-
uniqueness validation.
|
796
|
-
|
797
|
-
Fixes #14172.
|
798
|
-
|
799
|
-
*Vilius Luneckas* *Ahmed AbouElhamayed*
|
800
|
-
|
801
|
-
* `before_add` callbacks are fired before the record is saved on
|
802
|
-
`has_and_belongs_to_many` assocations *and* on `has_many :through`
|
803
|
-
associations. Before this change, `before_add` callbacks would be fired
|
804
|
-
before the record was saved on `has_and_belongs_to_many` associations, but
|
805
|
-
*not* on `has_many :through` associations.
|
806
|
-
|
807
|
-
Fixes #14144.
|
808
|
-
|
809
|
-
* Fixed STI classes not defining an attribute method if there is a
|
810
|
-
conflicting private method defined on its ancestors.
|
811
|
-
|
812
|
-
Fixes #11569.
|
813
|
-
|
814
|
-
*Godfrey Chan*
|
815
|
-
|
816
|
-
* Default scopes are no longer overriden by chained conditions.
|
817
|
-
|
818
|
-
Before this change when you defined a `default_scope` in a model
|
819
|
-
it was overriden by chained conditions in the same field. Now it
|
820
|
-
is merged like any other scope.
|
821
|
-
|
822
|
-
Before:
|
823
|
-
|
824
|
-
class User < ActiveRecord::Base
|
825
|
-
default_scope { where state: 'pending' }
|
826
|
-
scope :active, -> { where state: 'active' }
|
827
|
-
scope :inactive, -> { where state: 'inactive' }
|
828
|
-
end
|
829
|
-
|
830
|
-
User.all
|
831
|
-
# SELECT "users".* FROM "users" WHERE "users"."state" = 'pending'
|
832
|
-
|
833
|
-
User.active
|
834
|
-
# SELECT "users".* FROM "users" WHERE "users"."state" = 'active'
|
835
|
-
|
836
|
-
User.where(state: 'inactive')
|
837
|
-
# SELECT "users".* FROM "users" WHERE "users"."state" = 'inactive'
|
838
|
-
|
839
|
-
After:
|
840
|
-
|
841
|
-
class User < ActiveRecord::Base
|
842
|
-
default_scope { where state: 'pending' }
|
843
|
-
scope :active, -> { where state: 'active' }
|
844
|
-
scope :inactive, -> { where state: 'inactive' }
|
845
|
-
end
|
846
|
-
|
847
|
-
User.all
|
848
|
-
# SELECT "users".* FROM "users" WHERE "users"."state" = 'pending'
|
849
|
-
|
850
|
-
User.active
|
851
|
-
# SELECT "users".* FROM "users" WHERE "users"."state" = 'pending' AND "users"."state" = 'active'
|
852
|
-
|
853
|
-
User.where(state: 'inactive')
|
854
|
-
# SELECT "users".* FROM "users" WHERE "users"."state" = 'pending' AND "users"."state" = 'inactive'
|
855
|
-
|
856
|
-
To get the previous behavior it is needed to explicitly remove the
|
857
|
-
`default_scope` condition using `unscoped`, `unscope`, `rewhere` or
|
858
|
-
`except`.
|
859
|
-
|
860
|
-
Example:
|
861
|
-
|
862
|
-
class User < ActiveRecord::Base
|
863
|
-
default_scope { where state: 'pending' }
|
864
|
-
scope :active, -> { unscope(where: :state).where(state: 'active') }
|
865
|
-
scope :inactive, -> { rewhere state: 'inactive' }
|
866
|
-
end
|
867
|
-
|
868
|
-
User.all
|
869
|
-
# SELECT "users".* FROM "users" WHERE "users"."state" = 'pending'
|
870
|
-
|
871
|
-
User.active
|
872
|
-
# SELECT "users".* FROM "users" WHERE "users"."state" = 'active'
|
873
|
-
|
874
|
-
User.inactive
|
875
|
-
# SELECT "users".* FROM "users" WHERE "users"."state" = 'inactive'
|
876
|
-
|
877
|
-
* Perform necessary deeper encoding when hstore is inside an array.
|
878
|
-
|
879
|
-
Fixes #11135.
|
880
|
-
|
881
|
-
*Josh Goodall*, *Genadi Samokovarov*
|
882
|
-
|
883
|
-
* Properly detect if a connection is still active before using it
|
884
|
-
in multi-threaded environments.
|
885
|
-
|
886
|
-
Fixes #12867.
|
887
|
-
|
888
|
-
*Kevin Casey*, *Matthew Draper*, *William (B.J.) Snow Orvis*
|
889
|
-
|
890
|
-
* When inverting add_index use the index name if present instead of
|
891
|
-
the columns.
|
892
|
-
|
893
|
-
If there are two indices with matching columns and one of them is
|
894
|
-
explicitly named then reverting the migration adding the named one
|
895
|
-
would instead drop the unnamed one.
|
896
|
-
|
897
|
-
The inversion of add_index will now drop the index by its name if
|
898
|
-
it is present.
|
899
|
-
|
900
|
-
*Hubert Dąbrowski*
|
901
|
-
|
902
|
-
* Add flag to disable schema dump after migration.
|
903
|
-
|
904
|
-
Add a config parameter on Active Record named `dump_schema_after_migration`
|
905
|
-
which is true by default. Now schema dump does not happen at the
|
906
|
-
end of migration rake task if `dump_schema_after_migration` is false.
|
907
|
-
|
908
|
-
*Emil Soman*
|
909
|
-
|
910
|
-
* `find_in_batches`, `find_each`, `Result#each` and `Enumerable#index_by` now
|
911
|
-
return an `Enumerator` that can calculate its size.
|
912
|
-
|
913
|
-
See also #13938.
|
914
|
-
|
915
|
-
*Marc-André Lafortune*
|
916
|
-
|
917
|
-
* Make sure transaction state gets reset after a commit operation on the record.
|
918
|
-
|
919
|
-
If a new transaction was open inside a callback, the record was loosing track
|
920
|
-
of the transaction level state, and it was leaking that state.
|
921
|
-
|
922
|
-
Fixes #12566.
|
923
|
-
|
924
|
-
*arthurnn*
|
925
|
-
|
926
|
-
* Pass `has_and_belongs_to_many` `:autosave` option to
|
927
|
-
the underlying `has_many :through` association.
|
928
|
-
|
929
|
-
Fixes #13923.
|
930
|
-
|
931
|
-
*Yves Senn*
|
932
|
-
|
933
|
-
* PostgreSQL implementation of `SchemaStatements#index_name_exists?`.
|
934
|
-
|
935
|
-
The database agnostic implementation does not detect with indexes that are
|
936
|
-
not supported by the ActiveRecord schema dumper. For example, expressions
|
937
|
-
indexes would not be detected.
|
938
|
-
|
939
|
-
Fixes #11018.
|
940
|
-
|
941
|
-
*Jonathan Baudanza*
|
942
|
-
|
943
|
-
* Parsing PostgreSQL arrays with empty strings now works correctly.
|
944
|
-
|
945
|
-
Previously, if you tried to parse `{"1","","2","","3"}` the result
|
946
|
-
would be `["1","2","3"]`, removing the empty strings from the array,
|
947
|
-
which would be incorrect. Now it will correctly produce `["1","","2","","3"]`
|
948
|
-
as the result of parsing the above PostgreSQL array.
|
949
|
-
|
950
|
-
Fixes #13907.
|
951
|
-
|
952
|
-
*Maurício Linhares*
|
953
|
-
|
954
|
-
* Associations now raise `ArgumentError` on name conflicts.
|
955
|
-
|
956
|
-
Dangerous association names conflicts include instance or class methods already
|
957
|
-
defined by `ActiveRecord::Base`.
|
958
|
-
|
959
|
-
Example:
|
960
|
-
|
961
|
-
class Car < ActiveRecord::Base
|
962
|
-
has_many :errors
|
963
|
-
end
|
964
|
-
# Will raise ArgumentError.
|
965
|
-
|
966
|
-
Fixes #13217.
|
967
|
-
|
968
|
-
*Lauro Caetano*
|
969
|
-
|
970
|
-
* Fix regressions on `select_*` methods.
|
971
|
-
When `select_*` methods receive a `Relation` object, they should be able to
|
972
|
-
get the arel/binds from it.
|
973
|
-
Also fix regressions on `select_rows` that was ignoring the binds.
|
974
|
-
|
975
|
-
Fixes #7538, #12017, #13731, #12056.
|
976
|
-
|
977
|
-
*arthurnn*
|
978
|
-
|
979
|
-
* Active Record objects can now be correctly dumped, loaded and dumped again
|
980
|
-
without issues.
|
981
|
-
|
982
|
-
Previously, if you did `YAML.dump`, `YAML.load` and then `YAML.dump` again
|
983
|
-
in an Active Record model that used serialization it would fail at the last
|
984
|
-
dump due to the fields not being correctly serialized before being dumped
|
985
|
-
to YAML. Now it is possible to dump and load the same object as many times
|
986
|
-
as needed without any issues.
|
987
|
-
|
988
|
-
Fixes #13861.
|
989
|
-
|
990
|
-
*Maurício Linhares*
|
991
|
-
|
992
|
-
* `find_in_batches` now returns an `Enumerator` when called without a block, so that it
|
993
|
-
can be chained with other `Enumerable` methods.
|
994
|
-
|
995
|
-
*Marc-André Lafortune*
|
996
|
-
|
997
|
-
* `enum` now raises on "dangerous" name conflicts.
|
998
|
-
|
999
|
-
Dangerous name conflicts includes instance or class method conflicts
|
1000
|
-
with methods defined within `ActiveRecord::Base` but not its ancestors,
|
1001
|
-
as well as conflicts with methods generated by other enums on the same
|
1002
|
-
class.
|
1003
|
-
|
1004
|
-
Fixes #13389.
|
1005
|
-
|
1006
|
-
*Godfrey Chan*
|
1007
|
-
|
1008
|
-
* `scope` now raises on "dangerous" name conflicts.
|
1009
|
-
|
1010
|
-
Similar to dangerous attribute methods, a scope name conflict is
|
1011
|
-
dangerous if it conflicts with an existing class method defined within
|
1012
|
-
`ActiveRecord::Base` but not its ancestors.
|
1013
|
-
|
1014
|
-
See also #13389.
|
1015
|
-
|
1016
|
-
*Godfrey Chan*, *Philippe Creux*
|
1017
|
-
|
1018
|
-
* Correctly send an user provided statement to a `lock!()` call.
|
1019
|
-
|
1020
|
-
person.lock! 'FOR SHARE NOWAIT'
|
1021
|
-
# Before: SELECT * ... LIMIT 1 FOR UPDATE
|
1022
|
-
# After: SELECT * ... LIMIT 1 FOR SHARE NOWAIT
|
1023
|
-
|
1024
|
-
Fixes #13788.
|
1025
|
-
|
1026
|
-
*Maurício Linhares*
|
1027
|
-
|
1028
|
-
* Handle aliased attributes `select()`, `order()` and `reorder()`.
|
1029
|
-
|
1030
|
-
*Tsutomu Kuroda*
|
1031
|
-
|
1032
|
-
* Reset the collection association when calling `reset` on it.
|
1033
|
-
|
1034
|
-
Before:
|
1035
|
-
|
1036
|
-
post.comments.loaded? # => true
|
1037
|
-
post.comments.reset
|
1038
|
-
post.comments.loaded? # => true
|
1039
|
-
|
1040
|
-
After:
|
1041
|
-
|
1042
|
-
post.comments.loaded? # => true
|
1043
|
-
post.comments.reset
|
1044
|
-
post.comments.loaded? # => false
|
1045
|
-
|
1046
|
-
Fixes #13777.
|
1047
|
-
|
1048
|
-
*Kelsey Schlarman*
|
1049
|
-
|
1050
|
-
* Make enum fields work as expected with the `ActiveModel::Dirty` API.
|
1051
|
-
|
1052
|
-
Before this change, using the dirty API would have surprising results:
|
1053
|
-
|
1054
|
-
conversation = Conversation.new
|
1055
|
-
conversation.status = :active
|
1056
|
-
conversation.status = :archived
|
1057
|
-
conversation.status_was # => 0
|
1058
|
-
|
1059
|
-
After this change, the same code would result in:
|
1060
|
-
|
1061
|
-
conversation = Conversation.new
|
1062
|
-
conversation.status = :active
|
1063
|
-
conversation.status = :archived
|
1064
|
-
conversation.status_was # => "active"
|
1065
|
-
|
1066
|
-
*Rafael Mendonça França*
|
1067
|
-
|
1068
|
-
* `has_one` and `belongs_to` accessors don't add ORDER BY to the queries
|
1069
|
-
anymore.
|
1070
|
-
|
1071
|
-
Since Rails 4.0, we add an ORDER BY in the `first` method to ensure
|
1072
|
-
consistent results among different database engines. But for singular
|
1073
|
-
associations this behavior is not needed since we will have one record to
|
1074
|
-
return. As this ORDER BY option can lead some performance issues we are
|
1075
|
-
removing it for singular associations accessors.
|
1076
|
-
|
1077
|
-
Fixes #12623.
|
1078
|
-
|
1079
|
-
*Rafael Mendonça França*
|
1080
|
-
|
1081
|
-
* Prepend table name for column names passed to `Relation#select`.
|
1082
|
-
|
1083
|
-
Example:
|
1084
|
-
|
1085
|
-
Post.select(:id)
|
1086
|
-
# Before: => SELECT id FROM "posts"
|
1087
|
-
# After: => SELECT "posts"."id" FROM "posts"
|
1088
|
-
|
1089
|
-
*Yves Senn*
|
1090
|
-
|
1091
|
-
* Fail early with "Primary key not included in the custom select clause"
|
1092
|
-
in `find_in_batches`.
|
1093
|
-
|
1094
|
-
Before this patch, the exception was raised after the first batch was
|
1095
|
-
yielded to the block. This means that you only get it, when you hit the
|
1096
|
-
`batch_size` treshold. This could shadow the issue in development.
|
1097
|
-
|
1098
|
-
*Alexander Balashov*
|
1099
|
-
|
1100
|
-
* Ensure `second` through `fifth` methods act like the `first` finder.
|
1101
|
-
|
1102
|
-
The famous ordinal Array instance methods defined in ActiveSupport
|
1103
|
-
(`first`, `second`, `third`, `fourth`, and `fifth`) are now available as
|
1104
|
-
full-fledged finders in ActiveRecord. The biggest benefit of this is ordering
|
1105
|
-
of the records returned now defaults to the table's primary key in ascending order.
|
1106
|
-
|
1107
|
-
Fixes #13743.
|
1108
|
-
|
1109
|
-
Example:
|
1110
|
-
|
1111
|
-
User.all.second
|
1112
|
-
|
1113
|
-
# Before
|
1114
|
-
# => 'SELECT "users".* FROM "users"'
|
1115
|
-
|
1116
|
-
# After
|
1117
|
-
# => SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1 OFFSET 1'
|
1118
|
-
|
1119
|
-
User.offset(3).second
|
1120
|
-
|
1121
|
-
# Before
|
1122
|
-
# => 'SELECT "users".* FROM "users" LIMIT -1 OFFSET 3' # sqlite3 gem
|
1123
|
-
# => 'SELECT "users".* FROM "users" OFFSET 3' # pg gem
|
1124
|
-
# => 'SELECT `users`.* FROM `users` LIMIT 18446744073709551615 OFFSET 3' # mysql2 gem
|
1125
|
-
|
1126
|
-
# After
|
1127
|
-
# => SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1 OFFSET 4'
|
1128
|
-
|
1129
|
-
*Jason Meller*
|
1130
|
-
|
1131
|
-
* ActiveRecord states are now correctly restored after a rollback for
|
1132
|
-
models that did not define any transactional callbacks (i.e.
|
1133
|
-
`after_commit`, `after_rollback` or `after_create`).
|
1134
|
-
|
1135
|
-
Fixes #13744.
|
1136
|
-
|
1137
|
-
*Godfrey Chan*
|
1138
|
-
|
1139
|
-
* Make `touch` fire the `after_commit` and `after_rollback` callbacks.
|
1140
|
-
|
1141
|
-
*Harry Brundage*
|
1142
|
-
|
1143
|
-
* Enable partial indexes for `sqlite >= 3.8.0`.
|
1144
|
-
|
1145
|
-
See http://www.sqlite.org/partialindex.html
|
1146
|
-
|
1147
|
-
*Cody Cutrer*
|
1148
|
-
|
1149
|
-
* Don't try to get the subclass if the inheritance column doesn't exist
|
1150
|
-
|
1151
|
-
The `subclass_from_attrs` method is called even if the column specified by
|
1152
|
-
the `inheritance_column` setting doesn't exist. This prevents setting associations
|
1153
|
-
via the attributes hash if the association name clashes with the value of the setting,
|
1154
|
-
typically `:type`. This worked previously in Rails 3.2.
|
1155
|
-
|
1156
|
-
*Ujjwal Thaakar*
|
1157
|
-
|
1158
|
-
* Enum mappings are now exposed via class methods instead of constants.
|
1159
|
-
|
1160
|
-
Example:
|
1161
|
-
|
1162
|
-
class Conversation < ActiveRecord::Base
|
1163
|
-
enum status: [ :active, :archived ]
|
1164
|
-
end
|
1165
|
-
|
1166
|
-
Before:
|
1167
|
-
|
1168
|
-
Conversation::STATUS # => { "active" => 0, "archived" => 1 }
|
1169
|
-
|
1170
|
-
After:
|
1171
|
-
|
1172
|
-
Conversation.statuses # => { "active" => 0, "archived" => 1 }
|
1173
|
-
|
1174
|
-
*Godfrey Chan*
|
1175
|
-
|
1176
|
-
* Set `NameError#name` when STI-class-lookup fails.
|
1177
|
-
|
1178
|
-
*Chulki Lee*
|
1179
|
-
|
1180
|
-
* Fix bug in `becomes!` when changing from the base model to a STI sub-class.
|
1181
|
-
|
1182
|
-
Fixes #13272.
|
1183
|
-
|
1184
|
-
*the-web-dev*, *Yves Senn*
|
1185
|
-
|
1186
|
-
* Currently Active Record can be configured via the environment variable
|
1187
|
-
`DATABASE_URL` or by manually injecting a hash of values which is what Rails does,
|
1188
|
-
reading in `database.yml` and setting Active Record appropriately. Active Record
|
1189
|
-
expects to be able to use `DATABASE_URL` without the use of Rails, and we cannot
|
1190
|
-
rip out this functionality without deprecating. This presents a problem though
|
1191
|
-
when both config is set, and a `DATABASE_URL` is present. Currently the
|
1192
|
-
`DATABASE_URL` should "win" and none of the values in `database.yml` are
|
1193
|
-
used. This is somewhat unexpected, if one were to set values such as
|
1194
|
-
`pool` in the `production:` group of `database.yml` they are ignored.
|
1195
|
-
|
1196
|
-
There are many ways that Active Record initiates a connection today:
|
1197
|
-
|
1198
|
-
- Stand Alone (without rails)
|
1199
|
-
- `rake db:<tasks>`
|
1200
|
-
- `ActiveRecord.establish_connection`
|
1201
|
-
|
1202
|
-
- With Rails
|
1203
|
-
- `rake db:<tasks>`
|
1204
|
-
- `rails <server> | <console>`
|
1205
|
-
- `rails dbconsole`
|
1206
|
-
|
1207
|
-
Now all of these behave exactly the same way. The best way to do
|
1208
|
-
this is to put all of this logic in one place so it is guaranteed to be used.
|
1209
|
-
|
1210
|
-
Here is the matrix of how this behavior works:
|
1211
|
-
|
1212
|
-
```
|
1213
|
-
No database.yml
|
1214
|
-
No DATABASE_URL
|
1215
|
-
=> Error
|
1216
|
-
```
|
1217
|
-
|
1218
|
-
```
|
1219
|
-
database.yml present
|
1220
|
-
No DATABASE_URL
|
1221
|
-
=> Use database.yml configuration
|
1222
|
-
```
|
1223
|
-
|
1224
|
-
```
|
1225
|
-
No database.yml
|
1226
|
-
DATABASE_URL present
|
1227
|
-
=> use DATABASE_URL configuration
|
1228
|
-
```
|
1229
|
-
|
1230
|
-
```
|
1231
|
-
database.yml present
|
1232
|
-
DATABASE_URL present
|
1233
|
-
=> Merged into `url` sub key. If both specify `url` sub key, the `database.yml` `url`
|
1234
|
-
sub key "wins". If other paramaters `adapter` or `database` are specified in YAML,
|
1235
|
-
they are discarded as the `url` sub key "wins".
|
1236
|
-
```
|
1237
|
-
|
1238
|
-
Current implementation uses `ActiveRecord::Base.configurations` to resolve and merge
|
1239
|
-
all connection information before returning. This is achieved through a utility
|
1240
|
-
class: `ActiveRecord::ConnectionHandling::MergeAndResolveDefaultUrlConfig`.
|
1241
|
-
|
1242
|
-
To understand the exact behavior of this class, it is best to review the
|
1243
|
-
behavior in `activerecord/test/cases/connection_adapters/connection_handler_test.rb`.
|
1244
|
-
|
1245
|
-
*Richard Schneeman*
|
1246
|
-
|
1247
|
-
* Make `change_column_null` revertable. Fixes #13576.
|
1248
|
-
|
1249
|
-
*Yves Senn*, *Nishant Modak*, *Prathamesh Sonpatki*
|
1250
|
-
|
1251
|
-
* Don't create/drop the test database if RAILS_ENV is specified explicitly.
|
1252
|
-
|
1253
|
-
Previously, when the environment was development, we would always
|
1254
|
-
create or drop both the test and development databases.
|
1255
|
-
|
1256
|
-
Now, if RAILS_ENV is explicitly defined as development, we don't create
|
1257
|
-
the test database.
|
1258
|
-
|
1259
|
-
*Damien Mathieu*
|
1260
|
-
|
1261
|
-
* Initialize version on Migration objects so that it can be used in a migration,
|
1262
|
-
and it will be included in the announce message.
|
1263
|
-
|
1264
|
-
*Dylan Thacker-Smith*
|
1265
|
-
|
1266
|
-
* `change_table` now uses the current adapter's `update_table_definition`
|
1267
|
-
method to retrieve a specific table definition.
|
1268
|
-
This ensures that `change_table` and `create_table` will use
|
1269
|
-
similar objects.
|
1270
|
-
|
1271
|
-
Fixes #13577, #13503.
|
1272
|
-
|
1273
|
-
*Nishant Modak*, *Prathamesh Sonpatki*, *Rafael Mendonça França*
|
1274
|
-
|
1275
|
-
* Fixed ActiveRecord::Store nil conversion TypeError when using YAML coder.
|
1276
|
-
In case the YAML passed as paramter is nil, uses an empty string.
|
1277
|
-
|
1278
|
-
Fixes #13570.
|
1279
|
-
|
1280
|
-
*Thales Oliveira*
|
1281
|
-
|
1282
|
-
* Deprecate unused `ActiveRecord::Base.symbolized_base_class`
|
1283
|
-
and `ActiveRecord::Base.symbolized_sti_name` without replacement.
|
1284
|
-
|
1285
|
-
*Yves Senn*
|
1286
|
-
|
1287
|
-
* Since the `test_help.rb` file in Railties now automatically maintains
|
1288
|
-
your test schema, the `rake db:test:*` tasks are deprecated. This
|
1289
|
-
doesn't stop you manually running other tasks on your test database
|
1290
|
-
if needed:
|
1291
|
-
|
1292
|
-
rake db:schema:load RAILS_ENV=test
|
1293
|
-
|
1294
|
-
*Jon Leighton*
|
1295
|
-
|
1296
|
-
* Fix presence validator for association when the associated record responds to `to_a`.
|
1297
|
-
|
1298
|
-
*gmarik*
|
1299
|
-
|
1300
|
-
* Fixed regression on preload/includes with multiple arguments failing in certain conditions,
|
1301
|
-
raising a NoMethodError internally by calling `reflect_on_association` for `NilClass:Class`.
|
1302
|
-
|
1303
|
-
Fixes #13437.
|
1304
|
-
|
1305
|
-
*Vipul A M*, *khustochka*
|
1306
|
-
|
1307
|
-
* Add the ability to nullify the `enum` column.
|
1308
|
-
|
1309
|
-
Example:
|
1310
|
-
|
1311
|
-
class Conversation < ActiveRecord::Base
|
1312
|
-
enum gender: [:female, :male]
|
1313
|
-
end
|
1314
|
-
|
1315
|
-
Conversation::GENDER # => { female: 0, male: 1 }
|
1316
|
-
|
1317
|
-
# conversation.update! gender: 0
|
1318
|
-
conversation.female!
|
1319
|
-
conversation.female? # => true
|
1320
|
-
conversation.gender # => "female"
|
1321
|
-
|
1322
|
-
# conversation.update! gender: nil
|
1323
|
-
conversation.gender = nil
|
1324
|
-
conversation.gender.nil? # => true
|
1325
|
-
conversation.gender # => nil
|
1326
|
-
|
1327
|
-
*Amr Tamimi*
|
1328
|
-
|
1329
|
-
* Connection specification now accepts a "url" key. The value of this
|
1330
|
-
key is expected to contain a database URL. The database URL will be
|
1331
|
-
expanded into a hash and merged.
|
1332
|
-
|
1333
|
-
*Richard Schneeman*
|
1334
|
-
|
1335
|
-
* An `ArgumentError` is now raised on a call to `Relation#where.not(nil)`.
|
1336
|
-
|
1337
|
-
Example:
|
1338
|
-
|
1339
|
-
User.where.not(nil)
|
1340
|
-
|
1341
|
-
# Before
|
1342
|
-
# => 'SELECT `users`.* FROM `users` WHERE (NOT (NULL))'
|
1343
|
-
|
1344
|
-
# After
|
1345
|
-
# => ArgumentError, 'Invalid argument for .where.not(), got nil.'
|
1346
|
-
|
1347
|
-
*Kuldeep Aggarwal*
|
1348
|
-
|
1349
|
-
* Deprecated use of string argument as a configuration lookup in
|
1350
|
-
`ActiveRecord::Base.establish_connection`. Instead, a symbol must be given.
|
1351
|
-
|
1352
|
-
*José Valim*
|
1353
|
-
|
1354
|
-
* Fixed `update_column`, `update_columns`, and `update_all` to correctly serialize
|
1355
|
-
values for `array`, `hstore` and `json` column types in PostgreSQL.
|
1356
|
-
|
1357
|
-
Fixes #12261.
|
1358
|
-
|
1359
|
-
*Tadas Tamosauskas*, *Carlos Antonio da Silva*
|
1360
|
-
|
1361
|
-
* Do not consider PostgreSQL array columns as number or text columns.
|
1362
|
-
|
1363
|
-
The code uses these checks in several places to know what to do with a
|
1364
|
-
particular column, for instance AR attribute query methods has a branch
|
1365
|
-
like this:
|
1366
|
-
|
1367
|
-
if column.number?
|
1368
|
-
!value.zero?
|
1369
|
-
end
|
1370
|
-
|
1371
|
-
This should never be true for array columns, since it would be the same
|
1372
|
-
as running [].zero?, which results in a NoMethodError exception.
|
1373
|
-
|
1374
|
-
Fixing this by ensuring that array columns in PostgreSQL never return
|
1375
|
-
true for number?/text? checks.
|
1376
|
-
|
1377
|
-
*Carlos Antonio da Silva*
|
1378
|
-
|
1379
|
-
* When connecting to a non-existant database, the error:
|
1380
|
-
`ActiveRecord::NoDatabaseError` will now be raised. When being used with Rails
|
1381
|
-
the error message will include information on how to create a database:
|
1382
|
-
`rake db:create`. Supported adapters: postgresql, mysql, mysql2, sqlite3
|
1383
|
-
|
1384
|
-
*Richard Schneeman*
|
1385
|
-
|
1386
|
-
* Do not raise `'cannot touch on a new record object'` exception on destroying
|
1387
|
-
already destroyed `belongs_to` association with `touch: true` option.
|
1388
|
-
|
1389
|
-
Fixes #13445.
|
1390
|
-
|
1391
|
-
Example:
|
1392
|
-
|
1393
|
-
# Given Comment has belongs_to :post, touch: true
|
1394
|
-
comment.post.destroy
|
1395
|
-
comment.destroy # no longer raises an error
|
1396
|
-
|
1397
|
-
*Paul Nikitochkin*
|
1398
|
-
|
1399
|
-
* Fix a bug when assigning an array containing string numbers to a
|
1400
|
-
PostgreSQL integer array column.
|
1401
|
-
|
1402
|
-
Fixes #13444.
|
1403
|
-
|
1404
|
-
Example:
|
1405
|
-
|
1406
|
-
# Given Book#ratings is of type :integer, array: true
|
1407
|
-
Book.new(ratings: [1, 2]) # worked before
|
1408
|
-
Book.new(ratings: ['1', '2']) # now works as well
|
1409
|
-
|
1410
|
-
*Damien Mathieu*
|
1411
|
-
|
1412
|
-
* Fix `PostgreSQL` insert to properly extract table name from multiline string SQL.
|
1413
|
-
|
1414
|
-
Previously, executing an insert SQL in `PostgreSQL` with a command like this:
|
1415
|
-
|
1416
|
-
insert into articles(
|
1417
|
-
number)
|
1418
|
-
values(
|
1419
|
-
5152
|
1420
|
-
)
|
1421
|
-
|
1422
|
-
would not work because the adapter was unable to extract the correct `articles`
|
1423
|
-
table name.
|
1424
|
-
|
1425
|
-
*Kuldeep Aggarwal*
|
1426
|
-
|
1427
|
-
* Correctly escape PostgreSQL arrays.
|
1428
|
-
|
1429
|
-
Fixes: CVE-2014-0080
|
1430
|
-
|
1431
|
-
* `Relation` no longer has mutator methods like `#map!` and `#delete_if`. Convert
|
1432
|
-
to an `Array` by calling `#to_a` before using these methods.
|
1433
|
-
|
1434
|
-
It intends to prevent odd bugs and confusion in code that call mutator
|
1435
|
-
methods directly on the `Relation`.
|
1436
|
-
|
1437
|
-
Example:
|
1438
|
-
|
1439
|
-
# Instead of this
|
1440
|
-
Author.where(name: 'Hank Moody').compact!
|
1441
|
-
|
1442
|
-
# Now you have to do this
|
1443
|
-
authors = Author.where(name: 'Hank Moody').to_a
|
1444
|
-
authors.compact!
|
1445
|
-
|
1446
|
-
*Lauro Caetano*
|
1447
|
-
|
1448
|
-
* Better support for `where()` conditions that use a `belongs_to`
|
1449
|
-
association name.
|
1450
|
-
|
1451
|
-
Using the name of an association in `where` previously worked only
|
1452
|
-
if the value was a single `ActiveRecord::Base` object. e.g.
|
1453
|
-
|
1454
|
-
Post.where(author: Author.first)
|
1455
|
-
|
1456
|
-
Any other values, including `nil`, would cause invalid SQL to be
|
1457
|
-
generated. This change supports arguments in the `where` query
|
1458
|
-
conditions where the key is a `belongs_to` association name and the
|
1459
|
-
value is `nil`, an `Array` of `ActiveRecord::Base` objects, or an
|
1460
|
-
`ActiveRecord::Relation` object.
|
1461
|
-
|
1462
|
-
class Post < ActiveRecord::Base
|
1463
|
-
belongs_to :author
|
1464
|
-
end
|
1465
|
-
|
1466
|
-
`nil` value finds records where the association is not set:
|
1467
|
-
|
1468
|
-
Post.where(author: nil)
|
1469
|
-
# SELECT "posts".* FROM "posts" WHERE "posts"."author_id" IS NULL
|
1470
|
-
|
1471
|
-
`Array` values find records where the association foreign key
|
1472
|
-
matches the ids of the passed ActiveRecord models, resulting
|
1473
|
-
in the same query as `Post.where(author_id: [1,2])`:
|
1474
|
-
|
1475
|
-
authors_array = [Author.find(1), Author.find(2)]
|
1476
|
-
Post.where(author: authors_array)
|
1477
|
-
# SELECT "posts".* FROM "posts" WHERE "posts"."author_id" IN (1, 2)
|
1478
|
-
|
1479
|
-
`ActiveRecord::Relation` values find records using the same
|
1480
|
-
query as `Post.where(author_id: Author.where(last_name: "Emde"))`
|
1481
|
-
|
1482
|
-
Post.where(author: Author.where(last_name: "Emde"))
|
1483
|
-
# SELECT "posts".* FROM "posts"
|
1484
|
-
# WHERE "posts"."author_id" IN (
|
1485
|
-
# SELECT "authors"."id" FROM "authors"
|
1486
|
-
# WHERE "authors"."last_name" = 'Emde')
|
1487
|
-
|
1488
|
-
Polymorphic `belongs_to` associations will continue to be handled
|
1489
|
-
appropriately, with the polymorphic `association_type` field added
|
1490
|
-
to the query to match the base class of the value. This feature
|
1491
|
-
previously only worked when the value was a single `ActveRecord::Base`.
|
1492
|
-
|
1493
|
-
class Post < ActiveRecord::Base
|
1494
|
-
belongs_to :author, polymorphic: true
|
1495
|
-
end
|
1496
|
-
|
1497
|
-
Post.where(author: Author.where(last_name: "Emde"))
|
1498
|
-
# Generates a query similar to:
|
1499
|
-
Post.where(author_id: Author.where(last_name: "Emde"), author_type: "Author")
|
1500
|
-
|
1501
|
-
*Martin Emde*
|
1502
|
-
|
1503
|
-
* Respect temporary option when dropping tables with MySQL.
|
1504
|
-
|
1505
|
-
Normal DROP TABLE also works, but commits the transaction.
|
1506
|
-
|
1507
|
-
drop_table :temporary_table, temporary: true
|
1508
|
-
|
1509
|
-
*Cody Cutrer*
|
1510
|
-
|
1511
|
-
* Add option to create tables from a query.
|
1512
|
-
|
1513
|
-
create_table(:long_query, temporary: true,
|
1514
|
-
as: "SELECT * FROM orders INNER JOIN line_items ON order_id=orders.id")
|
1515
|
-
|
1516
|
-
Generates:
|
1517
|
-
|
1518
|
-
CREATE TEMPORARY TABLE long_query AS
|
1519
|
-
SELECT * FROM orders INNER JOIN line_items ON order_id=orders.id
|
1520
|
-
|
1521
|
-
*Cody Cutrer*
|
1522
|
-
|
1523
|
-
* `db:test:clone` and `db:test:prepare` must load Rails environment.
|
1524
|
-
|
1525
|
-
`db:test:clone` and `db:test:prepare` use `ActiveRecord::Base`. configurations,
|
1526
|
-
so we need to load the Rails environment, otherwise the config wont be in place.
|
1527
|
-
|
1528
|
-
*arthurnn*
|
1529
|
-
|
1530
|
-
* Use the right column to type cast grouped calculations with custom expressions.
|
1531
|
-
|
1532
|
-
Fixes #13230.
|
1533
|
-
|
1534
|
-
Example:
|
1535
|
-
|
1536
|
-
# Before
|
1537
|
-
Account.group(:firm_name).sum('0.01 * credit_limit')
|
1538
|
-
# => { '37signals' => '0.5' }
|
1539
|
-
|
1540
|
-
# After
|
1541
|
-
Account.group(:firm_name).sum('0.01 * credit_limit')
|
1542
|
-
# => { '37signals' => 0.5 }
|
1543
|
-
|
1544
|
-
*Paul Nikitochkin*
|
1545
|
-
|
1546
|
-
* Polymorphic `belongs_to` associations with the `touch: true` option set update the timestamps of
|
1547
|
-
the old and new owner correctly when moved between owners of different types.
|
1548
|
-
|
1549
|
-
Example:
|
1550
|
-
|
1551
|
-
class Rating < ActiveRecord::Base
|
1552
|
-
belongs_to :rateable, polymorphic: true, touch: true
|
1553
|
-
end
|
1554
|
-
|
1555
|
-
rating = Rating.create rateable: Song.find(1)
|
1556
|
-
rating.update_attributes rateable: Book.find(2) # => timestamps of Song(1) and Book(2) are updated
|
1557
|
-
|
1558
|
-
*Severin Schoepke*
|
1559
|
-
|
1560
|
-
* Improve formatting of migration exception messages: make them easier to read
|
1561
|
-
with line breaks before/after, and improve the error for pending migrations.
|
1562
|
-
|
1563
|
-
*John Bachir*
|
1564
|
-
|
1565
|
-
* Fix `last` with `offset` to return the proper record instead of always the last one.
|
1566
|
-
|
1567
|
-
Example:
|
1568
|
-
|
1569
|
-
Model.offset(4).last
|
1570
|
-
# => returns the 4th record from the end.
|
1571
|
-
|
1572
|
-
Fixes #7441.
|
1573
|
-
|
1574
|
-
*kostya*, *Lauro Caetano*
|
1575
|
-
|
1576
|
-
* `type_to_sql` returns a `String` for unmapped columns. This fixes an error
|
1577
|
-
when using unmapped PostgreSQL array types.
|
1578
|
-
|
1579
|
-
Example:
|
1580
|
-
|
1581
|
-
change_colum :table, :column, :bigint, array: true
|
1582
|
-
|
1583
|
-
Fixes #13146.
|
1584
|
-
|
1585
|
-
*Jens Fahnenbruck*, *Yves Senn*
|
1586
|
-
|
1587
|
-
* Fix `QueryCache` to work with nested blocks, so that it will only clear the existing cache
|
1588
|
-
after leaving the outer block instead of clearing it right after the inner block is finished.
|
1589
|
-
|
1590
|
-
*Vipul A M*
|
1591
|
-
|
1592
|
-
* The ERB in fixture files is no longer evaluated in the context of the main
|
1593
|
-
object. Helper methods used by multiple fixtures should be defined on the
|
1594
|
-
class object returned by `ActiveRecord::FixtureSet.context_class`.
|
1595
|
-
|
1596
|
-
*Victor Costan*
|
1597
|
-
|
1598
|
-
* Previously, the `has_one` macro incorrectly accepted the `counter_cache`
|
1599
|
-
option, but never actually supported it. Now it will raise an `ArgumentError`
|
1600
|
-
when using `has_one` with `counter_cache`.
|
1601
|
-
|
1602
|
-
*Godfrey Chan*
|
1603
|
-
|
1604
|
-
* Implement `rename_index` natively for MySQL >= 5.7.
|
1605
|
-
|
1606
|
-
*Cody Cutrer*
|
1607
|
-
|
1608
|
-
* Fix bug when validating the uniqueness of an aliased attribute.
|
1609
|
-
|
1610
|
-
Fixes #12402.
|
1611
|
-
|
1612
|
-
*Lauro Caetano*
|
1613
|
-
|
1614
|
-
* Update counter cache on a `has_many` relationship regardless of default scope.
|
1615
|
-
|
1616
|
-
Fixes #12952.
|
1617
|
-
|
1618
|
-
*Uku Taht*
|
1619
|
-
|
1620
|
-
* `rename_index` adds the new index before removing the old one. This allows to
|
1621
|
-
rename indexes on columns with a foreign key and prevents the following error:
|
1622
|
-
|
1623
|
-
Cannot drop index 'index_engines_on_car_id': needed in a foreign key constraint
|
1624
|
-
|
1625
|
-
*Cody Cutrer*, *Yves Senn*
|
1626
|
-
|
1627
|
-
* Raise `ActiveRecord::RecordNotDestroyed` when a replaced child
|
1628
|
-
marked with `dependent: destroy` fails to be destroyed.
|
1629
|
-
|
1630
|
-
Fixes #12812.
|
1631
|
-
|
1632
|
-
*Brian Thomas Storti*
|
1633
|
-
|
1634
|
-
* Fix validation on uniqueness of empty association.
|
1635
|
-
|
1636
|
-
*Evgeny Li*
|
1637
|
-
|
1638
|
-
* Make `ActiveRecord::Relation#unscope` affect relations it is merged in to.
|
1639
|
-
|
1640
|
-
*Jon Leighton*
|
1641
|
-
|
1642
|
-
* Use strings to represent non-string `order_values`.
|
1643
|
-
|
1644
|
-
*Yves Senn*
|
1645
|
-
|
1646
|
-
* Checks to see if the record contains the foreign key to set the inverse automatically.
|
1647
|
-
|
1648
|
-
*Edo Balvers*
|
1649
|
-
|
1650
|
-
* Added `ActiveRecord::Base.to_param` for convenient "pretty" URLs derived from a model's attribute or method.
|
1651
|
-
|
1652
|
-
Example:
|
1653
|
-
|
1654
|
-
class User < ActiveRecord::Base
|
1655
|
-
to_param :name
|
1656
|
-
end
|
1657
|
-
|
1658
|
-
user = User.find_by(name: 'Fancy Pants')
|
1659
|
-
user.id # => 123
|
1660
|
-
user.to_param # => "123-fancy-pants"
|
1661
|
-
|
1662
|
-
*Javan Makhmali*
|
1663
|
-
|
1664
|
-
* Added `ActiveRecord::Base.no_touching`, which allows ignoring touch on models.
|
1665
|
-
|
1666
|
-
Example:
|
1667
|
-
|
1668
|
-
Post.no_touching do
|
1669
|
-
Post.first.touch
|
1670
|
-
end
|
1671
|
-
|
1672
|
-
*Sam Stephenson*, *Damien Mathieu*
|
1673
|
-
|
1674
|
-
* Prevent the counter cache from being decremented twice when destroying
|
1675
|
-
a record on a `has_many :through` association.
|
1676
|
-
|
1677
|
-
Fixes #11079.
|
1678
|
-
|
1679
|
-
*Dmitry Dedov*
|
1680
|
-
|
1681
|
-
* Unify boolean type casting for `MysqlAdapter` and `Mysql2Adapter`.
|
1682
|
-
`type_cast` will return `1` for `true` and `0` for `false`.
|
1683
|
-
|
1684
|
-
Fixes #11119.
|
1685
|
-
|
1686
|
-
*Adam Williams*, *Yves Senn*
|
1687
|
-
|
1688
|
-
* Fix bug where `has_one` association record update result in crash, when replaced with itself.
|
1689
|
-
|
1690
|
-
Fixes #12834.
|
1691
|
-
|
1692
|
-
*Denis Redozubov*, *Sergio Cambra*
|
1693
|
-
|
1694
|
-
* Log bind variables after they are type casted. This makes it more
|
1695
|
-
transparent what values are actually sent to the database.
|
1696
|
-
|
1697
|
-
irb(main):002:0> Event.find("im-no-integer")
|
1698
|
-
# Before: ... WHERE "events"."id" = $1 LIMIT 1 [["id", "im-no-integer"]]
|
1699
|
-
# After: ... WHERE "events"."id" = $1 LIMIT 1 [["id", 0]]
|
1700
|
-
|
1701
|
-
*Yves Senn*
|
1702
|
-
|
1703
|
-
* Fix uninitialized constant `TransactionState` error when `Marshall.load` is used on an Active Record result.
|
1704
|
-
|
1705
|
-
Fixes #12790.
|
1706
|
-
|
1707
|
-
*Jason Ayre*
|
1708
|
-
|
1709
|
-
* `.unscope` now removes conditions specified in `default_scope`.
|
1710
|
-
|
1711
|
-
*Jon Leighton*
|
1712
|
-
|
1713
|
-
* Added `ActiveRecord::QueryMethods#rewhere` which will overwrite an existing, named where condition.
|
1714
|
-
|
1715
|
-
Examples:
|
1716
|
-
|
1717
|
-
Post.where(trashed: true).where(trashed: false) #=> WHERE `trashed` = 1 AND `trashed` = 0
|
1718
|
-
Post.where(trashed: true).rewhere(trashed: false) #=> WHERE `trashed` = 0
|
1719
|
-
Post.where(active: true).where(trashed: true).rewhere(trashed: false) #=> WHERE `active` = 1 AND `trashed` = 0
|
1720
|
-
|
1721
|
-
*DHH*
|
1722
|
-
|
1723
|
-
* Extend `ActiveRecord::Base#cache_key` to take an optional list of timestamp attributes of which the highest will be used.
|
1724
|
-
|
1725
|
-
Example:
|
1726
|
-
|
1727
|
-
# last_reviewed_at will be used, if that's more recent than updated_at, or vice versa
|
1728
|
-
Person.find(5).cache_key(:updated_at, :last_reviewed_at)
|
1729
|
-
|
1730
|
-
*DHH*
|
1731
|
-
|
1732
|
-
* Added `ActiveRecord::Base#enum` for declaring enum attributes where the values map to integers in the database, but can be queried by name.
|
1733
|
-
|
1734
|
-
Example:
|
1735
|
-
|
1736
|
-
class Conversation < ActiveRecord::Base
|
1737
|
-
enum status: [:active, :archived]
|
1738
|
-
end
|
1739
|
-
|
1740
|
-
Conversation::STATUS # => { active: 0, archived: 1 }
|
1741
|
-
|
1742
|
-
# conversation.update! status: 0
|
1743
|
-
conversation.active!
|
1744
|
-
conversation.active? # => true
|
1745
|
-
conversation.status # => "active"
|
1746
|
-
|
1747
|
-
# conversation.update! status: 1
|
1748
|
-
conversation.archived!
|
1749
|
-
conversation.archived? # => true
|
1750
|
-
conversation.status # => "archived"
|
1751
|
-
|
1752
|
-
# conversation.update! status: 1
|
1753
|
-
conversation.status = :archived
|
1754
|
-
|
1755
|
-
*DHH*
|
1756
|
-
|
1757
|
-
* `ActiveRecord::Base#attribute_for_inspect` now truncates long arrays (more than 10 elements).
|
1758
|
-
|
1759
|
-
*Jan Bernacki*
|
1760
|
-
|
1761
|
-
* Allow for the name of the `schema_migrations` table to be configured.
|
1762
|
-
|
1763
|
-
*Jerad Phelps*
|
1764
|
-
|
1765
|
-
* Do not add to scope includes values from through associations.
|
1766
|
-
Fixed bug when providing `includes` in through association scope, and fetching targets.
|
1767
|
-
|
1768
|
-
Example:
|
1769
|
-
|
1770
|
-
class Vendor < ActiveRecord::Base
|
1771
|
-
has_many :relationships, -> { includes(:user) }
|
1772
|
-
has_many :users, through: :relationships
|
1773
|
-
end
|
1774
|
-
|
1775
|
-
vendor = Vendor.first
|
1776
|
-
|
1777
|
-
# Before
|
1778
|
-
|
1779
|
-
vendor.users.to_a # => Raises exception: not found `:user` for `User`
|
1780
|
-
|
1781
|
-
# After
|
1782
|
-
|
1783
|
-
vendor.users.to_a # => No exception is raised
|
1784
|
-
|
1785
|
-
Fixes #12242, #9517, #10240.
|
1786
|
-
|
1787
|
-
*Paul Nikitochkin*
|
1788
|
-
|
1789
|
-
* Type cast json values on write, so that the value is consistent
|
1790
|
-
with reading from the database.
|
1791
|
-
|
1792
|
-
Example:
|
1793
|
-
|
1794
|
-
x = JsonDataType.new tags: {"string" => "foo", :symbol => :bar}
|
1795
|
-
|
1796
|
-
# Before:
|
1797
|
-
x.tags # => {"string" => "foo", :symbol => :bar}
|
1798
|
-
|
1799
|
-
# After:
|
1800
|
-
x.tags # => {"string" => "foo", "symbol" => "bar"}
|
1801
|
-
|
1802
|
-
*Severin Schoepke*
|
1803
|
-
|
1804
|
-
* `ActiveRecord::Store` works together with PostgreSQL `hstore` columns.
|
1805
|
-
|
1806
|
-
Fixes #12452.
|
1807
|
-
|
1808
|
-
*Yves Senn*
|
1809
|
-
|
1810
|
-
* Fix bug where `ActiveRecord::Store` used a global `Hash` to keep track of
|
1811
|
-
all registered `stored_attributes`. Now every subclass of
|
1812
|
-
`ActiveRecord::Base` has it's own `Hash`.
|
1813
|
-
|
1814
|
-
*Yves Senn*
|
1815
|
-
|
1816
|
-
* Save `has_one` association when primary key is manually set.
|
1817
|
-
|
1818
|
-
Fixes #12302.
|
1819
|
-
|
1820
|
-
*Lauro Caetano*
|
1821
|
-
|
1822
|
-
* Allow any version of BCrypt when using `has_secure_password`.
|
1823
|
-
|
1824
|
-
*Mike Perham*
|
1825
|
-
|
1826
|
-
* Sub-query generated for `Relation` passed as array condition did not take in account
|
1827
|
-
bind values and have invalid syntax.
|
1828
|
-
|
1829
|
-
Generate sub-query with inline bind values.
|
1830
|
-
|
1831
|
-
Fixes #12586.
|
1832
|
-
|
1833
|
-
*Paul Nikitochkin*
|
1834
|
-
|
1835
|
-
* Fix a bug where rake db:structure:load crashed when the path contained
|
1836
|
-
spaces.
|
1837
|
-
|
1838
|
-
*Kevin Mook*
|
1839
|
-
|
1840
|
-
* `ActiveRecord::QueryMethods#unscope` unscopes negative equality
|
1841
|
-
|
1842
|
-
Allows you to call `#unscope` on a relation with negative equality
|
1843
|
-
operators, i.e. `Arel::Nodes::NotIn` and `Arel::Nodes::NotEqual` that have
|
1844
|
-
been generated through the use of `where.not`.
|
1845
|
-
|
1846
|
-
*Eric Hankins*
|
1847
|
-
|
1848
|
-
* Raise an exception when model without primary key calls `.find_with_ids`.
|
1849
|
-
|
1850
|
-
*Shimpei Makimoto*
|
1851
|
-
|
1852
|
-
* Make `Relation#empty?` use `exists?` instead of `count`.
|
1853
|
-
|
1854
|
-
*Szymon Nowak*
|
1855
|
-
|
1856
|
-
* `rake db:structure:dump` no longer crashes when the port was specified as `Fixnum`.
|
1857
|
-
|
1858
|
-
*Kenta Okamoto*
|
1859
|
-
|
1860
|
-
* `NullRelation#pluck` takes a list of columns
|
1861
|
-
|
1862
|
-
The method signature in `NullRelation` was updated to mimic that in
|
1863
|
-
`Calculations`.
|
1864
|
-
|
1865
|
-
*Derek Prior*
|
1866
|
-
|
1867
|
-
* `scope_chain` should not be mutated for other reflections.
|
1868
|
-
|
1869
|
-
Currently `scope_chain` uses same array for building different
|
1870
|
-
`scope_chain` for different associations. During processing
|
1871
|
-
these arrays are sometimes mutated and because of in-place
|
1872
|
-
mutation the changed `scope_chain` impacts other reflections.
|
1873
|
-
|
1874
|
-
Fix is to dup the value before adding to the `scope_chain`.
|
1875
|
-
|
1876
|
-
Fixes #3882.
|
1877
|
-
|
1878
|
-
*Neeraj Singh*
|
1879
|
-
|
1880
|
-
* Prevent the inversed association from being reloaded on save.
|
1881
|
-
|
1882
|
-
Fixes #9499.
|
1883
|
-
|
1884
|
-
*Dmitry Polushkin*
|
1885
|
-
|
1886
|
-
* Generate subquery for `Relation` if it passed as array condition for `where`
|
1887
|
-
method.
|
1888
|
-
|
1889
|
-
Example:
|
1890
|
-
|
1891
|
-
# Before
|
1892
|
-
Blog.where('id in (?)', Blog.where(id: 1))
|
1893
|
-
# => SELECT "blogs".* FROM "blogs" WHERE "blogs"."id" = 1
|
1894
|
-
# => SELECT "blogs".* FROM "blogs" WHERE (id IN (1))
|
1895
|
-
|
1896
|
-
# After
|
1897
|
-
Blog.where('id in (?)', Blog.where(id: 1).select(:id))
|
1898
|
-
# => SELECT "blogs".* FROM "blogs"
|
1899
|
-
# WHERE "blogs"."id" IN (SELECT "blogs"."id" FROM "blogs" WHERE "blogs"."id" = 1)
|
1900
|
-
|
1901
|
-
Fixes #12415.
|
1902
|
-
|
1903
|
-
*Paul Nikitochkin*
|
1904
|
-
|
1905
|
-
* For missed association exception message
|
1906
|
-
which is raised in `ActiveRecord::Associations::Preloader` class
|
1907
|
-
added owner record class name in order to simplify to find problem code.
|
1908
|
-
|
1909
|
-
*Paul Nikitochkin*
|
1910
|
-
|
1911
|
-
* `has_and_belongs_to_many` is now transparently implemented in terms of
|
1912
|
-
`has_many :through`. Behavior should remain the same, if not, it is a bug.
|
1913
|
-
|
1914
|
-
* `create_savepoint`, `rollback_to_savepoint` and `release_savepoint` accept
|
1915
|
-
a savepoint name.
|
1916
|
-
|
1917
|
-
*Yves Senn*
|
1918
|
-
|
1919
|
-
* Make `next_migration_number` accessible for third party generators.
|
1920
|
-
|
1921
|
-
*Yves Senn*
|
1922
|
-
|
1923
|
-
* Objects instantiated using a null relationship will now retain the
|
1924
|
-
attributes of the where clause.
|
1925
|
-
|
1926
|
-
Fixes #11676, #11675, #11376.
|
1927
|
-
|
1928
|
-
*Paul Nikitochkin*, *Peter Brown*, *Nthalk*
|
1929
|
-
|
1930
|
-
* Fixed `ActiveRecord::Associations::CollectionAssociation#find`
|
1931
|
-
when using `has_many` association with `:inverse_of` and finding an array of one element,
|
1932
|
-
it should return an array of one element too.
|
1933
|
-
|
1934
|
-
*arthurnn*
|
1935
|
-
|
1936
|
-
* Callbacks on has_many should access the in memory parent if a inverse_of is set.
|
1937
|
-
|
1938
|
-
*arthurnn*
|
1939
|
-
|
1940
|
-
* `ActiveRecord::ConnectionAdapters.string_to_time` respects
|
1941
|
-
string with timezone (e.g. Wed, 04 Sep 2013 20:30:00 JST).
|
1942
|
-
|
1943
|
-
Fixes #12278.
|
1944
|
-
|
1945
|
-
*kennyj*
|
1946
|
-
|
1947
|
-
* Calling `update_attributes` will now throw an `ArgumentError` whenever it
|
1948
|
-
gets a `nil` argument. More specifically, it will throw an error if the
|
1949
|
-
argument that it gets passed does not respond to to `stringify_keys`.
|
1950
|
-
|
1951
|
-
Example:
|
1952
|
-
|
1953
|
-
@my_comment.update_attributes(nil) # => raises ArgumentError
|
1954
|
-
|
1955
|
-
*John Wang*
|
1956
|
-
|
1957
|
-
* Deprecate `quoted_locking_column` method, which isn't used anywhere.
|
1958
|
-
|
1959
|
-
*kennyj*
|
1960
|
-
|
1961
|
-
* Migration dump UUID default functions to schema.rb.
|
1962
|
-
|
1963
|
-
Fixes #10751.
|
1964
|
-
|
1965
|
-
*kennyj*
|
1966
|
-
|
1967
|
-
* Fixed a bug in `ActiveRecord::Associations::CollectionAssociation#find_by_scan`
|
1968
|
-
when using `has_many` association with `:inverse_of` option and UUID primary key.
|
1969
|
-
|
1970
|
-
Fixes #10450.
|
1971
|
-
|
1972
|
-
*kennyj*
|
1973
|
-
|
1974
|
-
* Fix: joins association, with defined in the scope block constraints by using several
|
1975
|
-
where constraints and at least of them is not `Arel::Nodes::Equality`,
|
1976
|
-
generates invalid SQL expression.
|
1977
|
-
|
1978
|
-
Fixes #11963.
|
1979
|
-
|
1980
|
-
*Paul Nikitochkin*
|
1981
|
-
|
1982
|
-
* `CollectionAssociation#first`/`#last` (e.g. `has_many`) use a `LIMIT`ed
|
1983
|
-
query to fetch results rather than loading the entire collection.
|
1984
|
-
|
1985
|
-
*Lann Martin*
|
1986
|
-
|
1987
|
-
* Make possible to run SQLite rake tasks without the `Rails` constant defined.
|
1988
|
-
|
1989
|
-
*Damien Mathieu*
|
1990
|
-
|
1991
|
-
* Allow Relation#from to accept other relations with bind values.
|
1992
|
-
|
1993
|
-
*Ryan Wallace*
|
1994
|
-
|
1995
|
-
* Fix inserts with prepared statements disabled.
|
1996
|
-
|
1997
|
-
Fixes #12023.
|
1998
|
-
|
1999
|
-
*Rafael Mendonça França*
|
2000
|
-
|
2001
|
-
* Setting a has_one association on a new record no longer causes an empty
|
2002
|
-
transaction.
|
2003
|
-
|
2004
|
-
*Dylan Thacker-Smith*
|
2005
|
-
|
2006
|
-
* Fix `AR::Relation#merge` sometimes failing to preserve `readonly(false)` flag.
|
2007
|
-
|
2008
|
-
*thedarkone*
|
2009
|
-
|
2010
|
-
* Re-use `order` argument pre-processing for `reorder`.
|
2011
|
-
|
2012
|
-
*Paul Nikitochkin*
|
528
|
+
* Fixed serialized fields returning serialized data after being updated with
|
529
|
+
`update_column`.
|
2013
530
|
|
2014
|
-
*
|
2015
|
-
accept objects other than direct descendants of `ActiveRecord::Base` (decorated
|
2016
|
-
models, for example).
|
531
|
+
*Simon Hørup Eskildsen*
|
2017
532
|
|
2018
|
-
|
533
|
+
* Fixed polymorphic eager loading when using a String as foreign key.
|
2019
534
|
|
2020
|
-
|
2021
|
-
parentheses (eg. `($1.25) # => -1.25`)).
|
2022
|
-
Fixes #11899.
|
535
|
+
Fixes #14734.
|
2023
536
|
|
2024
|
-
*
|
537
|
+
*Lauro Caetano*
|
2025
538
|
|
2026
|
-
*
|
2027
|
-
common STRING datatype in SQL.
|
539
|
+
* Change belongs_to touch to be consistent with timestamp updates
|
2028
540
|
|
2029
|
-
|
541
|
+
If a model is set up with a belongs_to: touch relationship the parent
|
542
|
+
record will only be touched if the record was modified. This makes it
|
543
|
+
consistent with timestamp updating on the record itself.
|
2030
544
|
|
2031
|
-
*
|
545
|
+
*Brock Trappitt*
|
2032
546
|
|
2033
|
-
|
547
|
+
* Fixed the inferred table name of a has_and_belongs_to_many auxiliar
|
548
|
+
table inside a schema.
|
2034
549
|
|
2035
|
-
|
550
|
+
Fixes #14824.
|
2036
551
|
|
2037
|
-
|
552
|
+
*Eric Chahin*
|
2038
553
|
|
2039
|
-
|
2040
|
-
|
554
|
+
* Remove unused `:timestamp` type. Transparently alias it to `:datetime`
|
555
|
+
in all cases. Fixes inconsistencies when column types are sent outside of
|
556
|
+
`ActiveRecord`, such as for XML Serialization.
|
2041
557
|
|
2042
|
-
|
2043
|
-
record.logged_in_from_ip = 'bad ip address' # raise exception
|
558
|
+
*Sean Griffin*
|
2044
559
|
|
2045
|
-
|
2046
|
-
|
2047
|
-
record.logged_in_from_ip # => nil
|
2048
|
-
record.logged_in_from_ip_before_type_cast # => 'bad ip address'
|
560
|
+
* Fix bug that added `table_name_prefix` and `table_name_suffix` to
|
561
|
+
extension names in PostgreSQL when migrating.
|
2049
562
|
|
2050
|
-
*
|
563
|
+
*Joao Carlos*
|
2051
564
|
|
2052
|
-
* `
|
565
|
+
* The `:index` option in migrations, which previously was only available for
|
566
|
+
`references`, now works with any column types.
|
2053
567
|
|
2054
|
-
|
568
|
+
*Marc Schütz*
|
2055
569
|
|
2056
|
-
|
570
|
+
* Add support for counter name to be passed as parameter on `CounterCache::ClassMethods#reset_counters`.
|
2057
571
|
|
2058
|
-
*
|
2059
|
-
assignment of `has_many` associations, when the association was not
|
2060
|
-
yet loaded:
|
572
|
+
*jnormore*
|
2061
573
|
|
2062
|
-
|
2063
|
-
|
574
|
+
* Restrict deletion of record when using `delete_all` with `uniq`, `group`, `having`
|
575
|
+
or `offset`.
|
2064
576
|
|
2065
|
-
|
2066
|
-
|
2067
|
-
loading of the association
|
577
|
+
In these cases the generated query ignored them and that caused unintended
|
578
|
+
records to be deleted.
|
2068
579
|
|
2069
|
-
|
580
|
+
Fixes #11985.
|
2070
581
|
|
2071
|
-
*
|
582
|
+
*Leandro Facchinetti*
|
2072
583
|
|
2073
|
-
|
584
|
+
* Floats with limit >= 25 that get turned into doubles in MySQL no longer have
|
585
|
+
their limit dropped from the schema.
|
2074
586
|
|
2075
|
-
|
2076
|
-
with reading from the database.
|
587
|
+
Fixes #14135.
|
2077
588
|
|
2078
|
-
|
589
|
+
*Aaron Nelson*
|
2079
590
|
|
2080
|
-
|
591
|
+
* Fix how to calculate associated class name when using namespaced has_and_belongs_to_many
|
592
|
+
association.
|
2081
593
|
|
2082
|
-
|
2083
|
-
x.tags # => {"bool" => true, "number" => 5}
|
594
|
+
Fixes #14709.
|
2084
595
|
|
2085
|
-
|
2086
|
-
x.tags # => {"bool" => "true", "number" => "5"}
|
596
|
+
*Kassio Borges*
|
2087
597
|
|
2088
|
-
|
598
|
+
* `ActiveRecord::Relation::Merger#filter_binds` now compares equivalent symbols and
|
599
|
+
strings in column names as equal.
|
2089
600
|
|
2090
|
-
|
601
|
+
This fixes a rare case in which more bind values are passed than there are
|
602
|
+
placeholders for them in the generated SQL statement, which can make PostgreSQL
|
603
|
+
throw a `StatementInvalid` exception.
|
2091
604
|
|
2092
|
-
*
|
605
|
+
*Nat Budin*
|
2093
606
|
|
2094
|
-
*
|
607
|
+
* Fix `stored_attributes` to correctly merge the details of stored
|
608
|
+
attributes defined in parent classes.
|
2095
609
|
|
2096
|
-
Fixes #
|
610
|
+
Fixes #14672.
|
2097
611
|
|
2098
|
-
*
|
612
|
+
*Brad Bennett*, *Jessica Yao*, *Lakshmi Parthasarathy*
|
2099
613
|
|
2100
|
-
*
|
614
|
+
* `change_column_default` allows `[]` as argument to `change_column_default`.
|
2101
615
|
|
2102
|
-
|
616
|
+
Fixes #11586.
|
2103
617
|
|
2104
|
-
*
|
618
|
+
*Yves Senn*
|
2105
619
|
|
2106
|
-
|
620
|
+
* Handle `name` and `"char"` column types in the PostgreSQL adapter.
|
2107
621
|
|
2108
|
-
|
2109
|
-
|
622
|
+
`name` and `"char"` are special character types used internally by
|
623
|
+
PostgreSQL and are used by internal system catalogs. These field types
|
624
|
+
can sometimes show up in structure-sniffing queries that feature internal system
|
625
|
+
structures or with certain PostgreSQL extensions.
|
2110
626
|
|
2111
|
-
*
|
627
|
+
*J Smith*, *Yves Senn*
|
2112
628
|
|
2113
|
-
*
|
2114
|
-
|
629
|
+
* Fix `PostgreSQLAdapter::OID::Float#type_cast` to convert Infinity and
|
630
|
+
NaN PostgreSQL values into a native Ruby `Float::INFINITY` and `Float::NAN`
|
2115
631
|
|
2116
632
|
Before:
|
2117
633
|
|
2118
|
-
|
2119
|
-
#
|
634
|
+
Point.create(value: 1.0/0)
|
635
|
+
Point.last.value # => 0.0
|
2120
636
|
|
2121
637
|
After:
|
2122
638
|
|
2123
|
-
|
2124
|
-
#
|
639
|
+
Point.create(value: 1.0/0)
|
640
|
+
Point.last.value # => Infinity
|
2125
641
|
|
2126
|
-
|
642
|
+
*Innokenty Mikhailov*
|
2127
643
|
|
2128
|
-
*
|
2129
|
-
For example, adding a very vendor specific regex implementation:
|
644
|
+
* Allow the PostgreSQL adapter to handle bigserial primary key types again.
|
2130
645
|
|
2131
|
-
|
2132
|
-
Arel::Nodes::InfixOperation.new('~', column, value.source)
|
2133
|
-
end
|
2134
|
-
ActiveRecord::PredicateBuilder.register_handler(Regexp, regex_handler)
|
646
|
+
Fixes #10410.
|
2135
647
|
|
2136
|
-
*
|
648
|
+
*Patrick Robertson*
|
2137
649
|
|
2138
|
-
*
|
650
|
+
* Deprecate joining, eager loading and preloading of instance dependent
|
651
|
+
associations without replacement. These operations happen before instances
|
652
|
+
are created. The current behavior is unexpected and can result in broken
|
653
|
+
behavior.
|
2139
654
|
|
2140
|
-
|
2141
|
-
By enforcing the provision of the column for this internal method
|
2142
|
-
we ensure that those using adapters that require column information
|
2143
|
-
will always get the proper behavior.
|
655
|
+
Fixes #15024.
|
2144
656
|
|
2145
|
-
*
|
657
|
+
*Yves Senn*
|
2146
658
|
|
2147
|
-
*
|
2148
|
-
to allow the connection adapter to properly determine how to quote the value. This was
|
2149
|
-
affecting certain databases that use specific column types.
|
659
|
+
* Fixed has_and_belongs_to_many's CollectionAssociation size calculation.
|
2150
660
|
|
2151
|
-
|
661
|
+
has_and_belongs_to_many should fall back to using the normal CollectionAssociation's
|
662
|
+
size calculation if the collection is not cached or loaded.
|
2152
663
|
|
2153
|
-
|
664
|
+
Fixes #14913, #14914.
|
2154
665
|
|
2155
|
-
*
|
666
|
+
*Fred Wu*
|
2156
667
|
|
2157
|
-
|
668
|
+
* Return a non zero status when running `rake db:migrate:status` and migration table does
|
669
|
+
not exist.
|
2158
670
|
|
2159
|
-
|
2160
|
-
not rescue from Exception (but only from StandardError), the Connection
|
2161
|
-
Pool quickly runs out of connections when multiple erroneous Requests come
|
2162
|
-
in right after each other.
|
671
|
+
*Paul B.*
|
2163
672
|
|
2164
|
-
|
2165
|
-
behaviour.
|
673
|
+
* Add support for module-level `table_name_suffix` in models.
|
2166
674
|
|
2167
|
-
|
675
|
+
This makes `table_name_suffix` work the same way as `table_name_prefix` when
|
676
|
+
using namespaced models.
|
2168
677
|
|
2169
|
-
*
|
678
|
+
*Jenner LaFave*
|
2170
679
|
|
2171
|
-
|
680
|
+
* Revert the behaviour of `ActiveRecord::Relation#join` changed through 4.0 => 4.1 to 4.0.
|
2172
681
|
|
2173
|
-
|
682
|
+
In 4.1.0 `Relation#join` is delegated to `Arel#SelectManager`.
|
683
|
+
In 4.0 series it is delegated to `Array#join`.
|
2174
684
|
|
2175
|
-
*
|
685
|
+
*Bogdan Gusiev*
|
2176
686
|
|
2177
|
-
*
|
687
|
+
* Log nil binary column values correctly.
|
2178
688
|
|
2179
|
-
|
689
|
+
When an object with a binary column is updated with a nil value
|
690
|
+
in that column, the SQL logger would throw an exception when trying
|
691
|
+
to log that nil value. This only occurs when updating a record
|
692
|
+
that already has a non-nil value in that column since an initial nil
|
693
|
+
value isn't included in the SQL anyway (at least, when dirty checking
|
694
|
+
is enabled.) The column's new value will now be logged as `<NULL binary data>`
|
695
|
+
to parallel the existing `<N bytes of binary data>` for non-nil values.
|
2180
696
|
|
2181
|
-
*
|
697
|
+
*James Coleman*
|
2182
698
|
|
2183
|
-
*
|
2184
|
-
|
699
|
+
* Rails will now pass a custom validation context through to autosave associations
|
700
|
+
in order to validate child associations with the same context.
|
2185
701
|
|
2186
|
-
|
2187
|
-
self.column_defaults # if we call this unintentionally before setting locking_column ...
|
2188
|
-
self.locking_column = 'my_locking_column'
|
2189
|
-
end
|
702
|
+
Fixes #13854.
|
2190
703
|
|
2191
|
-
|
2192
|
-
=> nil # expected value is 0 !
|
704
|
+
*Eric Chahin*, *Aaron Nelson*, *Kevin Casey*
|
2193
705
|
|
2194
|
-
|
706
|
+
* Stringify all variables keys of MySQL connection configuration.
|
2195
707
|
|
2196
|
-
|
2197
|
-
|
708
|
+
When `sql_mode` variable for MySQL adapters set in configuration as `String`
|
709
|
+
was ignored and overwritten by strict mode option.
|
2198
710
|
|
2199
|
-
Fixes #
|
711
|
+
Fixes #14895.
|
2200
712
|
|
2201
713
|
*Paul Nikitochkin*
|
2202
714
|
|
2203
|
-
*
|
2204
|
-
`primary_keys`, `tables`, `columns` and `columns_hash`.
|
715
|
+
* Ensure SQLite3 statements are closed on errors.
|
2205
716
|
|
2206
|
-
|
717
|
+
Fixes #13631.
|
2207
718
|
|
2208
|
-
*
|
719
|
+
*Timur Alperovich*
|
2209
720
|
|
2210
|
-
|
721
|
+
* Give ActiveRecord::PredicateBuilder private methods the privacy they deserve.
|
2211
722
|
|
2212
|
-
*
|
723
|
+
*Hector Satre*
|
2213
724
|
|
2214
|
-
|
725
|
+
* When using a custom `join_table` name on a `habtm`, rails was not saving it
|
726
|
+
on Reflections. This causes a problem when rails loads fixtures, because it
|
727
|
+
uses the reflections to set database with fixtures.
|
2215
728
|
|
2216
|
-
|
729
|
+
Fixes #14845.
|
2217
730
|
|
2218
|
-
*
|
731
|
+
*Kassio Borges*
|
2219
732
|
|
2220
|
-
*
|
2221
|
-
|
733
|
+
* Reset the cache when modifying a Relation with cached Arel.
|
734
|
+
Additionally display a warning message to make the user aware.
|
2222
735
|
|
2223
|
-
*
|
736
|
+
*Yves Senn*
|
2224
737
|
|
2225
|
-
*
|
738
|
+
* PostgreSQL should internally use `:datetime` consistently for TimeStamp. Assures
|
739
|
+
different spellings of timestamps are treated the same.
|
2226
740
|
|
2227
|
-
|
741
|
+
Example:
|
2228
742
|
|
2229
|
-
|
743
|
+
mytimestamp.simplified_type('timestamp without time zone')
|
744
|
+
# => :datetime
|
745
|
+
mytimestamp.simplified_type('timestamp(6) without time zone')
|
746
|
+
# => also :datetime (previously would be :timestamp)
|
2230
747
|
|
2231
|
-
|
748
|
+
See #14513.
|
2232
749
|
|
2233
|
-
*
|
2234
|
-
method. You can use `#transaction_open?` instead.
|
750
|
+
*Jefferson Lai*
|
2235
751
|
|
2236
|
-
|
752
|
+
* `ActiveRecord::Base.no_touching` no longer triggers callbacks or start empty transactions.
|
2237
753
|
|
2238
|
-
|
2239
|
-
|
754
|
+
Fixes #14841.
|
755
|
+
|
756
|
+
*Lucas Mazza*
|
2240
757
|
|
2241
|
-
|
758
|
+
* Fix name collision with `Array#select!` with `Relation#select!`.
|
2242
759
|
|
2243
|
-
|
760
|
+
Fixes #14752.
|
2244
761
|
|
2245
|
-
*
|
762
|
+
*Earl St Sauver*
|
2246
763
|
|
2247
|
-
*
|
764
|
+
* Fixed unexpected behavior for `has_many :through` associations going through a scoped `has_many`.
|
2248
765
|
|
2249
|
-
|
766
|
+
If a `has_many` association is adjusted using a scope, and another `has_many :through`
|
767
|
+
uses this association, then the scope adjustment is unexpectedly neglected.
|
2250
768
|
|
2251
|
-
|
2252
|
-
suite. The class is no longer public and is only used for internal
|
2253
|
-
Rails tests.
|
769
|
+
Fixes #14537.
|
2254
770
|
|
2255
|
-
*
|
771
|
+
*Jan Habermann*
|
2256
772
|
|
2257
|
-
*
|
2258
|
-
in associations.
|
773
|
+
* `@destroyed` should always be set to `false` when an object is duped.
|
2259
774
|
|
2260
|
-
*
|
775
|
+
*Kuldeep Aggarwal*
|
2261
776
|
|
2262
|
-
*
|
777
|
+
* Fixed has_many association to make it support irregular inflections.
|
2263
778
|
|
2264
|
-
|
779
|
+
Fixes #8928.
|
2265
780
|
|
2266
|
-
*
|
781
|
+
*arthurnn*, *Javier Goizueta*
|
2267
782
|
|
2268
|
-
|
783
|
+
* Fixed a problem where count used with a grouping was not returning a Hash.
|
2269
784
|
|
2270
|
-
|
785
|
+
Fixes #14721.
|
2271
786
|
|
2272
|
-
*
|
787
|
+
*Eric Chahin*
|
2273
788
|
|
2274
|
-
*
|
789
|
+
* `sanitize_sql_like` helper method to escape a string for safe use in an SQL
|
790
|
+
LIKE statement.
|
2275
791
|
|
2276
|
-
|
792
|
+
Example:
|
2277
793
|
|
2278
|
-
|
794
|
+
class Article
|
795
|
+
def self.search(term)
|
796
|
+
where("title LIKE ?", sanitize_sql_like(term))
|
797
|
+
end
|
798
|
+
end
|
2279
799
|
|
2280
|
-
|
800
|
+
Article.search("20% _reduction_")
|
801
|
+
# => Query looks like "... title LIKE '20\% \_reduction\_' ..."
|
2281
802
|
|
2282
|
-
*
|
803
|
+
*Rob Gilson*, *Yves Senn*
|
2283
804
|
|
2284
|
-
|
2285
|
-
feature was deprecated in Rails 4.0. This is being removed.
|
2286
|
-
`delete_all` will continue to honor the `:dependent` option. However
|
2287
|
-
if `:dependent` value is `:destroy` then the `:delete_all` deletion
|
2288
|
-
strategy for that collection will be applied.
|
805
|
+
* Do not quote uuid default value on `change_column`.
|
2289
806
|
|
2290
|
-
|
2291
|
-
`delete_all`. For example you can do `@post.comments.delete_all(:nullify)`.
|
807
|
+
Fixes #14604.
|
2292
808
|
|
2293
|
-
*
|
809
|
+
*Eric Chahin*
|
2294
810
|
|
2295
|
-
*
|
811
|
+
* The comparison between `Relation` and `CollectionProxy` should be consistent.
|
2296
812
|
|
2297
|
-
|
813
|
+
Example:
|
2298
814
|
|
2299
|
-
|
815
|
+
author.posts == Post.where(author_id: author.id)
|
816
|
+
# => true
|
817
|
+
Post.where(author_id: author.id) == author.posts
|
818
|
+
# => true
|
2300
819
|
|
2301
|
-
|
820
|
+
Fixes #13506.
|
2302
821
|
|
2303
|
-
*
|
2304
|
-
association.
|
822
|
+
*Lauro Caetano*
|
2305
823
|
|
2306
|
-
|
2307
|
-
collection
|
824
|
+
* Calling `delete_all` on an unloaded `CollectionProxy` no longer
|
825
|
+
generates an SQL statement containing each id of the collection:
|
2308
826
|
|
2309
|
-
|
827
|
+
Before:
|
2310
828
|
|
2311
|
-
|
2312
|
-
|
829
|
+
DELETE FROM `model` WHERE `model`.`parent_id` = 1
|
830
|
+
AND `model`.`id` IN (1, 2, 3...)
|
2313
831
|
|
2314
|
-
|
832
|
+
After:
|
2315
833
|
|
2316
|
-
|
834
|
+
DELETE FROM `model` WHERE `model`.`parent_id` = 1
|
2317
835
|
|
2318
|
-
*
|
836
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
2319
837
|
|
2320
|
-
*
|
838
|
+
* Fixed error for aggregate methods (`empty?`, `any?`, `count`) with `select`
|
839
|
+
which created invalid SQL.
|
2321
840
|
|
2322
|
-
|
841
|
+
Fixes #13648.
|
2323
842
|
|
2324
|
-
*
|
2325
|
-
`partial_updates=`.
|
843
|
+
*Simon Woker*
|
2326
844
|
|
2327
|
-
|
845
|
+
* PostgreSQL adapter only warns once for every missing OID per connection.
|
2328
846
|
|
2329
|
-
|
847
|
+
Fixes #14275.
|
2330
848
|
|
2331
|
-
*
|
849
|
+
*Matthew Draper*, *Yves Senn*
|
2332
850
|
|
2333
|
-
*
|
851
|
+
* PostgreSQL adapter automatically reloads it's type map when encountering
|
852
|
+
unknown OIDs.
|
2334
853
|
|
2335
|
-
|
854
|
+
Fixes #14678.
|
2336
855
|
|
2337
|
-
*
|
856
|
+
*Matthew Draper*, *Yves Senn*
|
2338
857
|
|
2339
|
-
|
858
|
+
* Fix insertion of records via `has_many :through` association with scope.
|
2340
859
|
|
2341
|
-
|
2342
|
-
Comment.where('posts.author_id' => 7)
|
860
|
+
Fixes #3548.
|
2343
861
|
|
2344
|
-
|
2345
|
-
Comment.references(:posts).where('posts.author_id' => 7)
|
862
|
+
*Ivan Antropov*
|
2346
863
|
|
2347
|
-
|
864
|
+
* Auto-generate stable fixture UUIDs on PostgreSQL.
|
2348
865
|
|
2349
|
-
|
866
|
+
Fixes #11524.
|
2350
867
|
|
2351
|
-
|
2352
|
-
default_scope -> { where published: true }
|
2353
|
-
end
|
868
|
+
*Roderick van Domburg*
|
2354
869
|
|
2355
|
-
|
2356
|
-
|
2357
|
-
end
|
870
|
+
* Fixed a problem where an enum would overwrite values of another enum
|
871
|
+
with the same name in an unrelated class.
|
2358
872
|
|
2359
|
-
|
2360
|
-
comments on published posts, since that is the default scope for
|
2361
|
-
posts.
|
873
|
+
Fixes #14607.
|
2362
874
|
|
2363
|
-
|
2364
|
-
so we'd get comments on unpublished posts.
|
875
|
+
*Evan Whalen*
|
2365
876
|
|
2366
|
-
|
877
|
+
* PostgreSQL and SQLite string columns no longer have a default limit of 255.
|
2367
878
|
|
2368
|
-
|
879
|
+
Fixes #13435, #9153.
|
2369
880
|
|
2370
|
-
|
881
|
+
*Vladimir Sazhin*, *Toms Mikoss*, *Yves Senn*
|
2371
882
|
|
2372
|
-
*
|
883
|
+
* Make possible to have an association called `records`.
|
2373
884
|
|
2374
|
-
|
885
|
+
Fixes #11645.
|
2375
886
|
|
2376
|
-
*
|
2377
|
-
can be chained with other `Enumerable` methods.
|
887
|
+
*prathamesh-sonpatki*
|
2378
888
|
|
2379
|
-
|
889
|
+
* `to_sql` on an association now matches the query that is actually executed, where it
|
890
|
+
could previously have incorrectly accrued additional conditions (e.g. as a result of
|
891
|
+
a previous query). CollectionProxy now always defers to the association scope's
|
892
|
+
`arel` method so the (incorrect) inherited one should be entirely concealed.
|
2380
893
|
|
2381
|
-
|
2382
|
-
a block, so that it can be chained with other `Enumerable` methods.
|
894
|
+
Fixes #14003.
|
2383
895
|
|
2384
|
-
*
|
896
|
+
*Jefferson Lai*
|
2385
897
|
|
2386
|
-
*
|
898
|
+
* Block a few default Class methods as scope name.
|
2387
899
|
|
2388
|
-
|
2389
|
-
By flattening the array it ensures that string values are detected
|
2390
|
-
as strings and not arrays.
|
900
|
+
For instance, this will raise:
|
2391
901
|
|
2392
|
-
|
902
|
+
scope :public, -> { where(status: 1) }
|
2393
903
|
|
2394
|
-
*
|
904
|
+
*arthurnn*
|
2395
905
|
|
2396
|
-
*
|
906
|
+
* Fixed error when using `with_options` with lambda.
|
2397
907
|
|
2398
|
-
|
2399
|
-
comments for the given post to set the inverse association.
|
908
|
+
Fixes #9805.
|
2400
909
|
|
2401
|
-
|
2402
|
-
records and all these 100k records would be loaded in memory
|
2403
|
-
even though the comment id was supplied.
|
910
|
+
*Lauro Caetano*
|
2404
911
|
|
2405
|
-
|
2406
|
-
|
912
|
+
* Switch `sqlite3:///` URLs (which were temporarily
|
913
|
+
deprecated in 4.1) from relative to absolute.
|
2407
914
|
|
2408
|
-
|
915
|
+
If you still want the previous interpretation, you should replace
|
916
|
+
`sqlite3:///my/path` with `sqlite3:my/path`.
|
2409
917
|
|
2410
|
-
*
|
918
|
+
*Matthew Draper*
|
2411
919
|
|
2412
|
-
*
|
2413
|
-
new connection. This means that calling `inspect`, when the
|
2414
|
-
database is missing, will no longer raise an exception.
|
2415
|
-
Fixes #10936.
|
920
|
+
* Treat blank UUID values as `nil`.
|
2416
921
|
|
2417
922
|
Example:
|
2418
923
|
|
2419
|
-
|
2420
|
-
|
2421
|
-
*Yves Senn*
|
924
|
+
Sample.new(uuid_field: '') #=> <Sample id: nil, uuid_field: nil>
|
2422
925
|
|
2423
|
-
*
|
2424
|
-
Fixes #10881.
|
926
|
+
*Dmitry Lavrov*
|
2425
927
|
|
2426
|
-
|
928
|
+
* Enable support for materialized views on PostgreSQL >= 9.3.
|
2427
929
|
|
2428
|
-
*
|
930
|
+
*Dave Lee*
|
2429
931
|
|
2430
|
-
|
2431
|
-
`WHERE "users"."name" = 'a b'` then in the log all the
|
2432
|
-
whitespace is being squeezed. So the sql that is printed in the
|
2433
|
-
log is `WHERE "users"."name" = 'a b'`.
|
932
|
+
* The PostgreSQL adapter supports custom domains. Fixes #14305.
|
2434
933
|
|
2435
|
-
|
934
|
+
*Yves Senn*
|
2436
935
|
|
2437
|
-
|
936
|
+
* PostgreSQL `Column#type` is now determined through the corresponding OID.
|
937
|
+
The column types stay the same except for enum columns. They no longer have
|
938
|
+
`nil` as type but `enum`.
|
2438
939
|
|
2439
|
-
|
2440
|
-
This is relevant when `ENV["DATABASE_URL"]` is used in place of a `database.yml`.
|
940
|
+
See #7814.
|
2441
941
|
|
2442
942
|
*Yves Senn*
|
2443
943
|
|
2444
|
-
*
|
2445
|
-
closed connection.
|
944
|
+
* Fixed error when specifying a non-empty default value on a PostgreSQL array column.
|
2446
945
|
|
2447
|
-
|
946
|
+
Fixes #10613.
|
2448
947
|
|
2449
|
-
*
|
2450
|
-
For example, you need to change this:
|
948
|
+
*Luke Steensen*
|
2451
949
|
|
2452
|
-
|
2453
|
-
|
2454
|
-
has_many :taggings, through: :posts
|
2455
|
-
end
|
950
|
+
* Fixed error where .persisted? throws SystemStackError for an unsaved model with a
|
951
|
+
custom primary key that didn't save due to validation error.
|
2456
952
|
|
2457
|
-
|
2458
|
-
has_one :tagging
|
2459
|
-
has_many :taggings
|
2460
|
-
end
|
953
|
+
Fixes #14393.
|
2461
954
|
|
2462
|
-
|
2463
|
-
end
|
955
|
+
*Chris Finne*
|
2464
956
|
|
2465
|
-
|
957
|
+
* Introduce `validate` as an alias for `valid?`.
|
2466
958
|
|
2467
|
-
|
2468
|
-
has_many :posts
|
2469
|
-
has_many :taggings, through: :posts, source: :tagging
|
2470
|
-
end
|
959
|
+
This is more intuitive when you want to run validations but don't care about the return value.
|
2471
960
|
|
2472
|
-
|
2473
|
-
has_one :tagging
|
2474
|
-
has_many :taggings
|
2475
|
-
end
|
961
|
+
*Henrik Nyh*
|
2476
962
|
|
2477
|
-
|
2478
|
-
end
|
963
|
+
* Create indexes inline in CREATE TABLE for MySQL.
|
2479
964
|
|
2480
|
-
|
965
|
+
This is important, because adding an index on a temporary table after it has been created
|
966
|
+
would commit the transaction.
|
2481
967
|
|
2482
|
-
|
2483
|
-
|
2484
|
-
Fixes #5554.
|
968
|
+
It also allows creating and dropping indexed tables with fewer queries and fewer permissions
|
969
|
+
required.
|
2485
970
|
|
2486
971
|
Example:
|
2487
972
|
|
2488
|
-
|
2489
|
-
|
2490
|
-
# After => ActiveRecord::StatementInvalid
|
2491
|
-
|
2492
|
-
# you can still use `count(:all)` to perform a query unrelated to the
|
2493
|
-
# selected columns
|
2494
|
-
User.select("name, username").count(:all) # => SELECT count(*) FROM users
|
2495
|
-
|
2496
|
-
*Yves Senn*
|
2497
|
-
|
2498
|
-
* Rails now automatically detects inverse associations. If you do not set the
|
2499
|
-
`:inverse_of` option on the association, then Active Record will guess the
|
2500
|
-
inverse association based on heuristics.
|
2501
|
-
|
2502
|
-
Note that automatic inverse detection only works on `has_many`, `has_one`,
|
2503
|
-
and `belongs_to` associations. Extra options on the associations will
|
2504
|
-
also prevent the association's inverse from being found automatically.
|
2505
|
-
|
2506
|
-
The automatic guessing of the inverse association uses a heuristic based
|
2507
|
-
on the name of the class, so it may not work for all associations,
|
2508
|
-
especially the ones with non-standard names.
|
2509
|
-
|
2510
|
-
You can turn off the automatic detection of inverse associations by setting
|
2511
|
-
the `:inverse_of` option to `false` like so:
|
2512
|
-
|
2513
|
-
class Taggable < ActiveRecord::Base
|
2514
|
-
belongs_to :tag, inverse_of: false
|
973
|
+
create_table :temp, temporary: true, as: "SELECT id, name, zip FROM a_really_complicated_query" do |t|
|
974
|
+
t.index :zip
|
2515
975
|
end
|
976
|
+
# => CREATE TEMPORARY TABLE temp (INDEX (zip)) AS SELECT id, name, zip FROM a_really_complicated_query
|
2516
977
|
|
2517
|
-
*
|
978
|
+
*Cody Cutrer*, *Steve Rice*, *Rafael Mendonça Franca*
|
2518
979
|
|
2519
|
-
*
|
980
|
+
* Use singular table name in generated migrations when
|
981
|
+
`ActiveRecord::Base.pluralize_table_names` is `false`.
|
2520
982
|
|
2521
|
-
|
983
|
+
Fixes #13426.
|
984
|
+
|
985
|
+
*Kuldeep Aggarwal*
|
2522
986
|
|
2523
|
-
*
|
2524
|
-
explicitly to mark records as `readonly.
|
2525
|
-
Fixes #10615.
|
987
|
+
* `touch` accepts many attributes to be touched at once.
|
2526
988
|
|
2527
989
|
Example:
|
2528
990
|
|
2529
|
-
|
2530
|
-
|
2531
|
-
user.save! # will raise error
|
991
|
+
# touches :signed_at, :sealed_at, and :updated_at/on attributes.
|
992
|
+
Photo.last.touch(:signed_at, :sealed_at)
|
2532
993
|
|
2533
|
-
*
|
994
|
+
*James Pinto*
|
2534
995
|
|
2535
|
-
*
|
996
|
+
* `rake db:structure:dump` only dumps schema information if the schema
|
997
|
+
migration table exists.
|
2536
998
|
|
2537
|
-
Fixes #
|
999
|
+
Fixes #14217.
|
2538
1000
|
|
2539
1001
|
*Yves Senn*
|
2540
1002
|
|
2541
|
-
*
|
1003
|
+
* Reap connections that were checked out by now-dead threads, instead
|
1004
|
+
of waiting until they disconnect by themselves. Before this change,
|
1005
|
+
a suitably constructed series of short-lived threads could starve
|
1006
|
+
the connection pool, without ever having more than a couple alive at
|
1007
|
+
the same time.
|
2542
1008
|
|
2543
|
-
|
2544
|
-
|
2545
|
-
*Aaron Patterson*
|
1009
|
+
*Matthew Draper*
|
2546
1010
|
|
2547
|
-
*
|
1011
|
+
* `pk_and_sequence_for` now ensures that only the pg_depend entries
|
1012
|
+
pointing to pg_class, and thus only sequence objects, are considered.
|
2548
1013
|
|
2549
|
-
*
|
1014
|
+
*Josh Williams*
|
2550
1015
|
|
2551
|
-
*
|
2552
|
-
as it is no longer used by internals.
|
1016
|
+
* `where.not` adds `references` for `includes` like normal `where` calls do.
|
2553
1017
|
|
2554
|
-
|
1018
|
+
Fixes #14406.
|
2555
1019
|
|
2556
|
-
*
|
2557
|
-
is not blank.
|
1020
|
+
*Yves Senn*
|
2558
1021
|
|
2559
|
-
|
2560
|
-
being picked up in `method_missing`.
|
1022
|
+
* Extend fixture `$LABEL` replacement to allow string interpolation.
|
2561
1023
|
|
2562
|
-
|
2563
|
-
table name, and calls `proper_table_name` on the arguments before sending to
|
2564
|
-
`connection`. If `table_name_prefix` or `table_name_suffix` is used, the schema
|
2565
|
-
version changes to `prefix_version_suffix`, breaking `rake test:prepare`.
|
1024
|
+
Example:
|
2566
1025
|
|
2567
|
-
|
1026
|
+
martin:
|
1027
|
+
email: $LABEL@email.com
|
2568
1028
|
|
2569
|
-
|
1029
|
+
users(:martin).email # => martin@email.com
|
2570
1030
|
|
2571
|
-
*
|
1031
|
+
*Eric Steele*
|
2572
1032
|
|
2573
|
-
|
1033
|
+
* Add support for `Relation` be passed as parameter on `QueryCache#select_all`.
|
2574
1034
|
|
2575
|
-
|
1035
|
+
Fixes #14361.
|
2576
1036
|
|
2577
|
-
*
|
1037
|
+
*arthurnn*
|
2578
1038
|
|
2579
|
-
*
|
2580
|
-
`
|
2581
|
-
causing `PredicateBuilder` to call non-existent method
|
2582
|
-
`Class#reflect_on_association`.
|
1039
|
+
* Passing an Active Record object to `find` or `exists?` is now deprecated.
|
1040
|
+
Call `.id` on the object first.
|
2583
1041
|
|
2584
|
-
*
|
1042
|
+
*Aaron Patterson*
|
2585
1043
|
|
2586
|
-
*
|
1044
|
+
* Only use BINARY for MySQL case sensitive uniqueness check when column has a case insensitive collation.
|
2587
1045
|
|
2588
|
-
|
2589
|
-
failing since options is an array and not a hash.
|
1046
|
+
*Ryuta Kamizono*
|
2590
1047
|
|
2591
|
-
|
2592
|
-
change_table :users do |t|
|
2593
|
-
t.remove_index [:name, :email]
|
2594
|
-
end
|
2595
|
-
end
|
1048
|
+
* Support for MySQL 5.6 fractional seconds.
|
2596
1049
|
|
2597
|
-
|
1050
|
+
*arthurnn*, *Tatsuhiko Miyagawa*
|
2598
1051
|
|
2599
|
-
|
1052
|
+
* Support for Postgres `citext` data type enabling case-insensitive where
|
1053
|
+
values without needing to wrap in UPPER/LOWER sql functions.
|
2600
1054
|
|
2601
|
-
*
|
1055
|
+
*Troy Kruthoff*, *Lachlan Sylvester*
|
2602
1056
|
|
2603
|
-
*
|
1057
|
+
* Only save has_one associations if record has changes.
|
1058
|
+
Previously after save related callbacks, such as `#after_commit`, were triggered when the has_one
|
1059
|
+
object did not get saved to the db.
|
2604
1060
|
|
2605
|
-
|
2606
|
-
child object yourself before assignment, then the NestedAttributes
|
2607
|
-
module will not overwrite it, e.g.:
|
1061
|
+
*Alan Kennedy*
|
2608
1062
|
|
2609
|
-
|
2610
|
-
has_one :avatar
|
2611
|
-
accepts_nested_attributes_for :avatar
|
1063
|
+
* Allow strings to specify the `#order` value.
|
2612
1064
|
|
2613
|
-
|
2614
|
-
super || build_avatar(width: 200)
|
2615
|
-
end
|
2616
|
-
end
|
1065
|
+
Example:
|
2617
1066
|
|
2618
|
-
|
2619
|
-
member.avatar_attributes = {icon: 'sad'}
|
2620
|
-
member.avatar.width # => 200
|
1067
|
+
Model.order(id: 'asc').to_sql == Model.order(id: :asc).to_sql
|
2621
1068
|
|
2622
|
-
*
|
1069
|
+
*Marcelo Casiraghi*, *Robin Dupret*
|
2623
1070
|
|
2624
|
-
*
|
2625
|
-
|
2626
|
-
unique value' database error that would occur if a record being created had
|
2627
|
-
the same value on a unique indexed field as that of a record being destroyed.
|
1071
|
+
* Dynamically register PostgreSQL enum OIDs. This prevents "unknown OID"
|
1072
|
+
warnings on enum columns.
|
2628
1073
|
|
2629
|
-
*
|
1074
|
+
*Dieter Komendera*
|
2630
1075
|
|
2631
|
-
*
|
1076
|
+
* `includes` is able to detect the right preloading strategy when string
|
1077
|
+
joins are involved.
|
2632
1078
|
|
2633
|
-
|
1079
|
+
Fixes #14109.
|
2634
1080
|
|
2635
|
-
|
1081
|
+
*Aaron Patterson*, *Yves Senn*
|
2636
1082
|
|
2637
|
-
|
2638
|
-
|
2639
|
-
|
1083
|
+
* Fixed error with validation with enum fields for records where the
|
1084
|
+
value for any enum attribute is always evaluated as 0 during
|
1085
|
+
uniqueness validation.
|
2640
1086
|
|
2641
|
-
|
1087
|
+
Fixes #14172.
|
2642
1088
|
|
2643
|
-
|
1089
|
+
*Vilius Luneckas* *Ahmed AbouElhamayed*
|
2644
1090
|
|
2645
|
-
|
1091
|
+
* `before_add` callbacks are fired before the record is saved on
|
1092
|
+
`has_and_belongs_to_many` associations *and* on `has_many :through`
|
1093
|
+
associations. Before this change, `before_add` callbacks would be fired
|
1094
|
+
before the record was saved on `has_and_belongs_to_many` associations, but
|
1095
|
+
*not* on `has_many :through` associations.
|
2646
1096
|
|
2647
|
-
|
1097
|
+
Fixes #14144.
|
2648
1098
|
|
2649
|
-
|
1099
|
+
* Fixed STI classes not defining an attribute method if there is a
|
1100
|
+
conflicting private method defined on its ancestors.
|
2650
1101
|
|
2651
|
-
|
1102
|
+
Fixes #11569.
|
2652
1103
|
|
2653
1104
|
*Godfrey Chan*
|
2654
1105
|
|
2655
|
-
*
|
1106
|
+
* Coerce strings when reading attributes. Fixes #10485.
|
2656
1107
|
|
2657
|
-
|
1108
|
+
Example:
|
2658
1109
|
|
2659
|
-
|
1110
|
+
book = Book.new(title: 12345)
|
1111
|
+
book.save!
|
1112
|
+
book.title # => "12345"
|
2660
1113
|
|
2661
|
-
|
1114
|
+
*Yves Senn*
|
2662
1115
|
|
2663
|
-
|
1116
|
+
* Deprecate half-baked support for PostgreSQL range values with excluding beginnings.
|
1117
|
+
We currently map PostgreSQL ranges to Ruby ranges. This conversion is not fully
|
1118
|
+
possible because the Ruby range does not support excluded beginnings.
|
2664
1119
|
|
2665
|
-
|
1120
|
+
The current solution of incrementing the beginning is not correct and is now
|
1121
|
+
deprecated. For subtypes where we don't know how to increment (e.g. `#succ`
|
1122
|
+
is not defined) it will raise an ArgumentException for ranges with excluding
|
1123
|
+
beginnings.
|
2666
1124
|
|
2667
|
-
*
|
1125
|
+
*Yves Senn*
|
2668
1126
|
|
2669
|
-
*
|
1127
|
+
* Support for user created range types in PostgreSQL.
|
2670
1128
|
|
2671
|
-
*
|
1129
|
+
*Yves Senn*
|
2672
1130
|
|
2673
|
-
Please check [4-
|
1131
|
+
Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/activerecord/CHANGELOG.md) for previous changes.
|