activerecord 5.0.0 → 5.0.7.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activerecord might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/CHANGELOG.md +431 -2
- data/README.rdoc +1 -1
- data/lib/active_record/aggregations.rb +4 -2
- data/lib/active_record/association_relation.rb +4 -1
- data/lib/active_record/associations/association.rb +11 -1
- data/lib/active_record/associations/association_scope.rb +1 -1
- data/lib/active_record/associations/builder/has_and_belongs_to_many.rb +4 -2
- data/lib/active_record/associations/builder/singular_association.rb +10 -1
- data/lib/active_record/associations/collection_association.rb +56 -48
- data/lib/active_record/associations/collection_proxy.rb +38 -20
- data/lib/active_record/associations/has_many_association.rb +1 -7
- data/lib/active_record/associations/has_many_through_association.rb +2 -4
- data/lib/active_record/associations/join_dependency/join_association.rb +6 -11
- data/lib/active_record/associations/join_dependency/join_part.rb +2 -2
- data/lib/active_record/associations/join_dependency.rb +10 -4
- data/lib/active_record/associations/preloader/association.rb +24 -37
- data/lib/active_record/associations/preloader/collection_association.rb +0 -1
- data/lib/active_record/associations/preloader/singular_association.rb +0 -1
- data/lib/active_record/associations/preloader/through_association.rb +10 -4
- data/lib/active_record/associations/singular_association.rb +8 -2
- data/lib/active_record/associations/through_association.rb +1 -1
- data/lib/active_record/associations.rb +38 -17
- data/lib/active_record/attribute.rb +3 -3
- data/lib/active_record/attribute_methods/primary_key.rb +14 -1
- data/lib/active_record/attribute_methods/read.rb +1 -1
- data/lib/active_record/attribute_methods/time_zone_conversion.rb +2 -2
- data/lib/active_record/attribute_methods.rb +3 -7
- data/lib/active_record/attribute_set/builder.rb +37 -13
- data/lib/active_record/attribute_set.rb +2 -0
- data/lib/active_record/attributes.rb +3 -3
- data/lib/active_record/autosave_association.rb +15 -11
- data/lib/active_record/base.rb +1 -1
- data/lib/active_record/collection_cache_key.rb +16 -6
- data/lib/active_record/connection_adapters/abstract/connection_pool.rb +41 -33
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +1 -1
- data/lib/active_record/connection_adapters/abstract/query_cache.rb +37 -2
- data/lib/active_record/connection_adapters/abstract/quoting.rb +14 -5
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +11 -14
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +68 -56
- data/lib/active_record/connection_adapters/abstract_adapter.rb +36 -12
- data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +63 -60
- data/lib/active_record/connection_adapters/column.rb +1 -1
- data/lib/active_record/connection_adapters/mysql/column.rb +1 -1
- data/lib/active_record/connection_adapters/mysql/database_statements.rb +8 -25
- data/lib/active_record/connection_adapters/mysql/quoting.rb +1 -1
- data/lib/active_record/connection_adapters/mysql2_adapter.rb +2 -6
- data/lib/active_record/connection_adapters/postgresql/column.rb +28 -1
- data/lib/active_record/connection_adapters/postgresql/database_statements.rb +8 -0
- data/lib/active_record/connection_adapters/postgresql/oid/array.rb +12 -2
- data/lib/active_record/connection_adapters/postgresql/oid/bit.rb +2 -2
- data/lib/active_record/connection_adapters/postgresql/oid/bytea.rb +1 -1
- data/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +10 -0
- data/lib/active_record/connection_adapters/postgresql/quoting.rb +32 -3
- data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +18 -8
- data/lib/active_record/connection_adapters/postgresql/utils.rb +2 -2
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +25 -19
- data/lib/active_record/connection_adapters/sqlite3/quoting.rb +1 -1
- data/lib/active_record/connection_adapters/sqlite3_adapter.rb +4 -4
- data/lib/active_record/core.rb +6 -4
- data/lib/active_record/enum.rb +8 -5
- data/lib/active_record/explain.rb +20 -9
- data/lib/active_record/fixtures.rb +5 -5
- data/lib/active_record/gem_version.rb +2 -2
- data/lib/active_record/integration.rb +13 -10
- data/lib/active_record/log_subscriber.rb +19 -17
- data/lib/active_record/migration.rb +35 -14
- data/lib/active_record/model_schema.rb +161 -52
- data/lib/active_record/no_touching.rb +4 -0
- data/lib/active_record/persistence.rb +41 -20
- data/lib/active_record/query_cache.rb +15 -17
- data/lib/active_record/querying.rb +3 -3
- data/lib/active_record/railties/controller_runtime.rb +1 -1
- data/lib/active_record/railties/databases.rake +9 -21
- data/lib/active_record/reflection.rb +20 -0
- data/lib/active_record/relation/batches.rb +10 -10
- data/lib/active_record/relation/calculations.rb +16 -12
- data/lib/active_record/relation/delegation.rb +2 -1
- data/lib/active_record/relation/finder_methods.rb +13 -11
- data/lib/active_record/relation/query_methods.rb +3 -3
- data/lib/active_record/relation.rb +12 -5
- data/lib/active_record/result.rb +7 -1
- data/lib/active_record/sanitization.rb +11 -1
- data/lib/active_record/schema_dumper.rb +10 -17
- data/lib/active_record/scoping/default.rb +5 -1
- data/lib/active_record/scoping/named.rb +18 -6
- data/lib/active_record/scoping.rb +4 -3
- data/lib/active_record/serialization.rb +1 -1
- data/lib/active_record/statement_cache.rb +2 -2
- data/lib/active_record/table_metadata.rb +4 -3
- data/lib/active_record/tasks/database_tasks.rb +14 -11
- data/lib/active_record/tasks/postgresql_database_tasks.rb +1 -1
- data/lib/active_record/touch_later.rb +6 -1
- data/lib/active_record/transactions.rb +1 -1
- data/lib/active_record/type/internal/abstract_json.rb +5 -1
- data/lib/active_record/validations/uniqueness.rb +3 -4
- data/lib/active_record.rb +3 -2
- data/lib/rails/generators/active_record/migration/migration_generator.rb +1 -1
- data/lib/rails/generators/active_record/migration.rb +8 -0
- data/lib/rails/generators/active_record/model/model_generator.rb +1 -1
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 235a713e47ff9449c9c0ccceb33b51cfddf8aac53284ca0693c4a57d7578502a
|
4
|
+
data.tar.gz: 0a106230b5c2b5f05a9e64cdab3a084b1c6c406c2a2adb7f703d59a27ae376a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c585c0592c49ebe5ee2d6c1ccf1e0f3cd37f0b41ca26cb49246c1f8e99ee07a508bbc24c519114c5fe3dcd09960ca54d71af8ecbdb7cb13ee371e9054a842080
|
7
|
+
data.tar.gz: b7b18c7ccb0c602aa135e9420a1f9e7fc60dee5a1b81912c0fb936dcf7a3f3abf4e7ac857c9e061e80d033e245c5b2203078356635f1f2a87a5e8848201347c1
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,435 @@
|
|
1
|
+
## Rails 5.0.7.2 (March 11, 2019) ##
|
2
|
+
|
3
|
+
* No changes.
|
4
|
+
|
5
|
+
|
6
|
+
## Rails 5.0.7.1 (November 27, 2018) ##
|
7
|
+
|
8
|
+
* No changes.
|
9
|
+
|
10
|
+
|
11
|
+
## Rails 5.0.7 (March 29, 2018) ##
|
12
|
+
|
13
|
+
* Apply time column precision on assignment.
|
14
|
+
|
15
|
+
PR #20317 changed the behavior of datetime columns so that when they
|
16
|
+
have a specified precision then on assignment the value is rounded to
|
17
|
+
that precision. This behavior is now applied to time columns as well.
|
18
|
+
|
19
|
+
Fixes #30301.
|
20
|
+
|
21
|
+
*Andrew White*
|
22
|
+
|
23
|
+
* Normalize time column values for SQLite database.
|
24
|
+
|
25
|
+
For legacy reasons, time columns in SQLite are stored as full datetimes
|
26
|
+
because until #24542 the quoting for time columns didn't remove the date
|
27
|
+
component. To ensure that values are consistent we now normalize the
|
28
|
+
date component to 2001-01-01 on reading and writing.
|
29
|
+
|
30
|
+
*Andrew White*
|
31
|
+
|
32
|
+
* Ensure that the date component is removed when quoting times.
|
33
|
+
|
34
|
+
PR #24542 altered the quoting for time columns so that the date component
|
35
|
+
was removed however it only removed it when it was 2001-01-01. Now the
|
36
|
+
date component is removed irrespective of what the date is.
|
37
|
+
|
38
|
+
*Andrew White*
|
39
|
+
|
40
|
+
* Query cache was unavailable when entering the `ActiveRecord::Base.cache` block
|
41
|
+
without being connected.
|
42
|
+
|
43
|
+
*Tsukasa Oishi*
|
44
|
+
|
45
|
+
* Fix `bin/rails db:setup` and `bin/rails db:test:prepare` create wrong
|
46
|
+
ar_internal_metadata's data for a test database.
|
47
|
+
|
48
|
+
Before:
|
49
|
+
```
|
50
|
+
$ RAILS_ENV=test rails dbconsole
|
51
|
+
> SELECT * FROM ar_internal_metadata;
|
52
|
+
key|value|created_at|updated_at
|
53
|
+
environment|development|2017-09-11 23:14:10.815679|2017-09-11 23:14:10.815679
|
54
|
+
```
|
55
|
+
|
56
|
+
After:
|
57
|
+
```
|
58
|
+
$ RAILS_ENV=test rails dbconsole
|
59
|
+
> SELECT * FROM ar_internal_metadata;
|
60
|
+
key|value|created_at|updated_at
|
61
|
+
environment|test|2017-09-11 23:14:10.815679|2017-09-11 23:14:10.815679
|
62
|
+
```
|
63
|
+
|
64
|
+
Fixes #26731.
|
65
|
+
|
66
|
+
*bogdanvlviv*
|
67
|
+
|
68
|
+
* Fix longer sequence name detection for serial columns.
|
69
|
+
|
70
|
+
Fixes #28332.
|
71
|
+
|
72
|
+
*Ryuta Kamizono*
|
73
|
+
|
74
|
+
* Use `max_identifier_length` for `index_name_length` in PostgreSQL adapter.
|
75
|
+
|
76
|
+
*Ryuta Kamizono*
|
77
|
+
|
78
|
+
|
79
|
+
## Rails 5.0.6 (September 07, 2017) ##
|
80
|
+
|
81
|
+
* No changes.
|
82
|
+
|
83
|
+
|
84
|
+
## Rails 5.0.6.rc1 (August 24, 2017) ##
|
85
|
+
|
86
|
+
* Ensure `sum` honors `distinct` on `has_many :through` associations
|
87
|
+
|
88
|
+
Fixes #16791
|
89
|
+
|
90
|
+
*Aaron Wortham
|
91
|
+
|
92
|
+
|
93
|
+
## Rails 5.0.5 (July 31, 2017) ##
|
94
|
+
|
95
|
+
* No changes.
|
96
|
+
|
97
|
+
|
98
|
+
## Rails 5.0.5.rc2 (July 25, 2017) ##
|
99
|
+
|
100
|
+
* No changes.
|
101
|
+
|
102
|
+
|
103
|
+
## Rails 5.0.5.rc1 (July 19, 2017) ##
|
104
|
+
|
105
|
+
* `Relation#joins` is no longer affected by the target model's
|
106
|
+
`current_scope`, with the exception of `unscoped`.
|
107
|
+
|
108
|
+
Fixes #29338.
|
109
|
+
|
110
|
+
*Sean Griffin*
|
111
|
+
|
112
|
+
|
113
|
+
## Rails 5.0.4 (June 19, 2017) ##
|
114
|
+
|
115
|
+
* Restore previous behavior of collection proxies: their values can have
|
116
|
+
methods stubbed, and they respect extension modules applied by a default
|
117
|
+
scope.
|
118
|
+
|
119
|
+
*Ryuta Kamizono*
|
120
|
+
|
121
|
+
* Loading model schema from database is now thread-safe.
|
122
|
+
|
123
|
+
Fixes #28589.
|
124
|
+
|
125
|
+
*Vikrant Chaudhary*, *David Abdemoulaie*
|
126
|
+
|
127
|
+
|
128
|
+
## Rails 5.0.3 (May 12, 2017) ##
|
129
|
+
|
130
|
+
* Check whether `Rails.application` defined before calling it
|
131
|
+
|
132
|
+
In #27674 we changed the migration generator to generate migrations at the
|
133
|
+
path defined in `Rails.application.config.paths` however the code checked
|
134
|
+
for the presence of the `Rails` constant but not the `Rails.application`
|
135
|
+
method which caused problems when using Active Record and generators outside
|
136
|
+
of the context of a Rails application.
|
137
|
+
|
138
|
+
Fixes #28325.
|
139
|
+
|
140
|
+
* Fix `deserialize` with JSON array.
|
141
|
+
|
142
|
+
Fixes #28285.
|
143
|
+
|
144
|
+
*Ryuta Kamizono*
|
145
|
+
|
146
|
+
* Fix `rake db:schema:load` with subdirectories.
|
147
|
+
|
148
|
+
*Ryuta Kamizono*
|
149
|
+
|
150
|
+
* Fix `rake db:migrate:status` with subdirectories.
|
151
|
+
|
152
|
+
*Ryuta Kamizono*
|
153
|
+
|
154
|
+
* Don't share options between reference id and type columns
|
155
|
+
|
156
|
+
When using a polymorphic reference column in a migration, sharing options
|
157
|
+
between the two columns doesn't make sense since they are different types.
|
158
|
+
The `reference_id` column is usually an integer and the `reference_type`
|
159
|
+
column a string so options like `unsigned: true` will result in an invalid
|
160
|
+
table definition.
|
161
|
+
|
162
|
+
*Ryuta Kamizono*
|
163
|
+
|
164
|
+
* Fix regression of #1969 with SELECT aliases in HAVING clause.
|
165
|
+
|
166
|
+
*Eugene Kenny*
|
167
|
+
|
168
|
+
|
169
|
+
## Rails 5.0.2 (March 01, 2017) ##
|
170
|
+
|
171
|
+
* Fix `wait_timeout` to configurable for mysql2 adapter.
|
172
|
+
|
173
|
+
Fixes #26556.
|
174
|
+
|
175
|
+
*Ryuta Kamizono*
|
176
|
+
|
177
|
+
* Make `table_name=` reset current statement cache,
|
178
|
+
so queries are not run against the previous table name.
|
179
|
+
|
180
|
+
*namusyaka*
|
181
|
+
|
182
|
+
* Allow ActiveRecord::Base#as_json to be passed a frozen Hash.
|
183
|
+
|
184
|
+
*Isaac Betesh*
|
185
|
+
|
186
|
+
* Fix inspection behavior when the :id column is not primary key.
|
187
|
+
|
188
|
+
*namusyaka*
|
189
|
+
|
190
|
+
* Fix `association_primary_key_type` for reflections with symbol primary key
|
191
|
+
|
192
|
+
Fixes #27864
|
193
|
+
|
194
|
+
*Daniel Colson*
|
195
|
+
|
196
|
+
* Place generated migrations into the path set by `config.paths["db/migrate"]`
|
197
|
+
|
198
|
+
*Kevin Glowacz*
|
199
|
+
|
200
|
+
* Compare deserialized values for `PostgreSQL::OID::Hstore` types when
|
201
|
+
calling `ActiveRecord::Dirty#changed_in_place?`
|
202
|
+
|
203
|
+
Fixes #27502.
|
204
|
+
|
205
|
+
*Jon Moss*
|
206
|
+
|
207
|
+
* Respect precision option for arrays of timestamps.
|
208
|
+
|
209
|
+
Fixes #27514.
|
210
|
+
|
211
|
+
*Sean Griffin*
|
212
|
+
|
213
|
+
|
214
|
+
## Rails 5.0.1 (December 21, 2016) ##
|
215
|
+
|
216
|
+
* No changes.
|
217
|
+
|
218
|
+
|
219
|
+
## Rails 5.0.1.rc2 (December 10, 2016) ##
|
220
|
+
|
221
|
+
* Correct resolution of associated class in `has_many :through`
|
222
|
+
associations' `*_ids` setters.
|
223
|
+
|
224
|
+
Fixes #27297.
|
225
|
+
|
226
|
+
*Matthew Draper*
|
227
|
+
|
228
|
+
* Support index length and order options using both string and symbol
|
229
|
+
column names.
|
230
|
+
|
231
|
+
Fixes #27243.
|
232
|
+
|
233
|
+
*Ryuta Kamizono*
|
234
|
+
|
235
|
+
|
236
|
+
## Rails 5.0.1.rc1 (December 01, 2016) ##
|
237
|
+
|
238
|
+
* Fix that unsigned with zerofill is treated as signed.
|
239
|
+
|
240
|
+
Fixes #27125.
|
241
|
+
|
242
|
+
*Ryuta Kamizono*
|
243
|
+
|
244
|
+
* Fix the uniqueness validation scope with a polymorphic association.
|
245
|
+
|
246
|
+
*Sergey Alekseev*
|
247
|
+
|
248
|
+
* Raise ActiveRecord::RecordNotFound from collection `*_ids` setters
|
249
|
+
for unknown IDs with a better error message.
|
250
|
+
|
251
|
+
Changes the collection `*_ids` setters to cast provided IDs the data
|
252
|
+
type of the primary key set in the association, not the model
|
253
|
+
primary key.
|
254
|
+
|
255
|
+
*Dominic Cleal*
|
256
|
+
|
257
|
+
* Introduce `Model#reload_<association>` to bring back the behavior
|
258
|
+
of `Article.category(true)` where `category` is a singular
|
259
|
+
association.
|
260
|
+
|
261
|
+
The force reloading of the association reader was deprecated
|
262
|
+
in #20888. Unfortunately the suggested alternative of
|
263
|
+
`article.reload.category` does not expose the same behavior.
|
264
|
+
|
265
|
+
This patch adds a reader method with the prefix `reload_` for
|
266
|
+
singular associations. This method has the same semantics as
|
267
|
+
passing true to the association reader used to have.
|
268
|
+
|
269
|
+
*Yves Senn*
|
270
|
+
|
271
|
+
* Make sure eager loading `ActiveRecord::Associations` also loads
|
272
|
+
constants defined in `ActiveRecord::Associations::Preloader`.
|
273
|
+
|
274
|
+
*Yves Senn*
|
275
|
+
|
276
|
+
* Allow `ActionController::Parameters`-like objects to be passed as
|
277
|
+
values for Postgres HStore columns.
|
278
|
+
|
279
|
+
Fixes #26904.
|
280
|
+
|
281
|
+
*Jon Moss*
|
282
|
+
|
283
|
+
* Configure query caching (per thread) on the connection pool.
|
284
|
+
|
285
|
+
Moving the configuration to the pool means we don't allocate a connection
|
286
|
+
until it's actually needed.
|
287
|
+
|
288
|
+
Applications that manually interact with the connection pool and/or query
|
289
|
+
cache may notice that the connection's cache is now cleared and disabled
|
290
|
+
when it gets returned to the pool, even if the request is not yet completed.
|
291
|
+
|
292
|
+
*Samuel Cochran*, *Matthew Draper*
|
293
|
+
|
294
|
+
* Fixed support for case insensitive comparisons of `text` columns in
|
295
|
+
PostgreSQL.
|
296
|
+
|
297
|
+
*Edho Arief*
|
298
|
+
|
299
|
+
* Return `true` from `update_attribute` when the value of the attribute
|
300
|
+
to be updated is unchanged.
|
301
|
+
|
302
|
+
Fixes #26593.
|
303
|
+
|
304
|
+
*Prathamesh Sonpatki*
|
305
|
+
|
306
|
+
* Serialize JSON attribute value `nil` as SQL `NULL`, not JSON `null`
|
307
|
+
|
308
|
+
*Trung Duc Tran*
|
309
|
+
|
310
|
+
* Always store errors details information with symbols.
|
311
|
+
|
312
|
+
When the association is autosaved we were storing the details with
|
313
|
+
string keys. This was creating inconsistency with other details that are
|
314
|
+
added using the `Errors#add` method. It was also inconsistent with the
|
315
|
+
`Errors#messages` storage.
|
316
|
+
|
317
|
+
To fix this inconsistency we are always storing with symbols. This will
|
318
|
+
cause a small breaking change because in those cases the details could
|
319
|
+
be accessed as strings keys but now it can not.
|
320
|
+
|
321
|
+
Fix #26499.
|
322
|
+
|
323
|
+
*Rafael Mendonça França*, *Marcus Vieira*
|
324
|
+
|
325
|
+
* Using a mysql2 connection after it fails to reconnect will now have an error message
|
326
|
+
saying the connection is closed rather than an undefined method error message.
|
327
|
+
|
328
|
+
*Dylan Thacker-Smith*
|
329
|
+
|
330
|
+
* Remove unnecessarily association load when a `belongs_to` association has already been
|
331
|
+
loaded then the foreign key is changed directly and the record saved.
|
332
|
+
|
333
|
+
*James Coleman*
|
334
|
+
|
335
|
+
* PostgreSQL array columns will now respect the encoding of strings contained
|
336
|
+
in the array.
|
337
|
+
|
338
|
+
Fixes #26326.
|
339
|
+
|
340
|
+
*Sean Griffin*
|
341
|
+
|
342
|
+
* Inverse association instances will now be set before `after_find` or
|
343
|
+
`after_initialize` callbacks are run.
|
344
|
+
|
345
|
+
Fixes #26320.
|
346
|
+
|
347
|
+
*Sean Griffin*
|
348
|
+
|
349
|
+
* Avoid loading records from database when they are already loaded using
|
350
|
+
the `pluck` method on a collection.
|
351
|
+
|
352
|
+
Fixes #25921.
|
353
|
+
|
354
|
+
*Ryuta Kamizono*
|
355
|
+
|
356
|
+
* Sqlite3 migrations to add a column to an existing table can now be
|
357
|
+
successfully rolled back when the column was given and invalid column
|
358
|
+
type.
|
359
|
+
|
360
|
+
Fixes #26087
|
361
|
+
|
362
|
+
*Travis O'Neill*
|
363
|
+
|
364
|
+
* Hashes can once again be passed to setters of `composed_of`, if all of the
|
365
|
+
mapping methods are methods implemented on `Hash`.
|
366
|
+
|
367
|
+
Fixes #25978.
|
368
|
+
|
369
|
+
*Sean Griffin*
|
370
|
+
|
371
|
+
* Doing count on relations that contain LEFT OUTER JOIN Arel node no longer
|
372
|
+
force a DISTINCT. This solves issues when using count after a left_joins.
|
373
|
+
|
374
|
+
*Maxime Handfield Lapointe*
|
375
|
+
|
376
|
+
* RecordNotFound raised by association.find exposes `id`, `primary_key` and
|
377
|
+
`model` methods to be consistent with RecordNotFound raised by Record.find.
|
378
|
+
|
379
|
+
*Michel Pigassou*
|
380
|
+
|
381
|
+
* Fix the SELECT statement in `#table_comment` for MySQL.
|
382
|
+
|
383
|
+
*Takeshi Akima*
|
384
|
+
|
385
|
+
* Virtual attributes will no longer raise when read on models loaded from the
|
386
|
+
database
|
387
|
+
|
388
|
+
*Sean Griffin*
|
389
|
+
|
390
|
+
* Fixes multi-parameter attributes conversion with invalid params.
|
391
|
+
|
392
|
+
*Hiroyuki Ishii*
|
393
|
+
|
394
|
+
* Add newline between each migration in `structure.sql`.
|
395
|
+
|
396
|
+
Keeps schema migration inserts as a single commit, but allows for easier
|
397
|
+
git diff-ing. Fixes #25504.
|
398
|
+
|
399
|
+
*Grey Baker*, *Norberto Lopes*
|
400
|
+
|
401
|
+
* Using `group` with an attribute that has a custom type will properly cast
|
402
|
+
the hash keys after calling a calculation method like `count`.
|
403
|
+
|
404
|
+
Fixes #25595.
|
405
|
+
|
406
|
+
*Sean Griffin*
|
407
|
+
|
408
|
+
* Ensure concurrent invocations of the connection reaper cannot allocate the
|
409
|
+
same connection to two threads.
|
410
|
+
|
411
|
+
Fixes #25585.
|
412
|
+
|
413
|
+
*Matthew Draper*
|
414
|
+
|
415
|
+
* Fixed dumping of foreign key's referential actions when MySQL connection
|
416
|
+
uses `sql_mode = ANSI_QUOTES`.
|
417
|
+
|
418
|
+
Fixes #25300.
|
419
|
+
|
420
|
+
*Ryuta Kamizono*
|
421
|
+
|
422
|
+
|
1
423
|
## Rails 5.0.0 (June 30, 2016) ##
|
2
424
|
|
425
|
+
* Inspecting an object with an associated array of over 10 elements no longer
|
426
|
+
truncates the array, preventing `inspect` from looping infinitely in some
|
427
|
+
cases.
|
428
|
+
|
429
|
+
*Kevin McPhillips*
|
430
|
+
|
3
431
|
* Ensure hashes can be assigned to attributes created using `composed_of`.
|
432
|
+
|
4
433
|
Fixes #25210.
|
5
434
|
|
6
435
|
*Sean Griffin*
|
@@ -279,7 +708,7 @@
|
|
279
708
|
|
280
709
|
*Takashi Kokubun*
|
281
710
|
|
282
|
-
* Add
|
711
|
+
* Add `#second_to_last` and `#third_to_last` finder methods.
|
283
712
|
|
284
713
|
*Brian Christian*
|
285
714
|
|
@@ -1020,7 +1449,7 @@
|
|
1020
1449
|
|
1021
1450
|
*Mehmet Emin İNAÇ*
|
1022
1451
|
|
1023
|
-
* Add `cache_key` to ActiveRecord::Relation
|
1452
|
+
* Add `cache_key` to `ActiveRecord::Relation`.
|
1024
1453
|
|
1025
1454
|
Example:
|
1026
1455
|
|
data/README.rdoc
CHANGED
@@ -192,7 +192,7 @@ The latest version of Active Record can be installed with RubyGems:
|
|
192
192
|
|
193
193
|
Source code can be downloaded as part of the Rails project on GitHub:
|
194
194
|
|
195
|
-
* https://github.com/rails/rails/tree/
|
195
|
+
* https://github.com/rails/rails/tree/5-0-stable/activerecord
|
196
196
|
|
197
197
|
|
198
198
|
== License
|
@@ -261,8 +261,10 @@ module ActiveRecord
|
|
261
261
|
part = converter.respond_to?(:call) ? converter.call(part) : klass.send(converter, part)
|
262
262
|
end
|
263
263
|
|
264
|
-
|
265
|
-
|
264
|
+
hash_from_multiparameter_assignment = part.is_a?(Hash) &&
|
265
|
+
part.each_key.all? { |k| k.is_a?(Integer) }
|
266
|
+
if hash_from_multiparameter_assignment
|
267
|
+
raise ArgumentError unless part.size == part.each_key.max
|
266
268
|
part = klass.new(*part.sort.map(&:last))
|
267
269
|
end
|
268
270
|
|
@@ -83,7 +83,7 @@ module ActiveRecord
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def scope
|
86
|
-
target_scope.merge(association_scope)
|
86
|
+
target_scope.merge!(association_scope)
|
87
87
|
end
|
88
88
|
|
89
89
|
# The scope for this association.
|
@@ -124,6 +124,16 @@ module ActiveRecord
|
|
124
124
|
AssociationRelation.create(klass, klass.arel_table, klass.predicate_builder, self).merge!(klass.all)
|
125
125
|
end
|
126
126
|
|
127
|
+
def extensions
|
128
|
+
extensions = klass.default_extensions | reflection.extensions
|
129
|
+
|
130
|
+
if scope = reflection.scope
|
131
|
+
extensions |= klass.unscoped.instance_exec(owner, &scope).extensions
|
132
|
+
end
|
133
|
+
|
134
|
+
extensions
|
135
|
+
end
|
136
|
+
|
127
137
|
# Loads the \target if needed and returns it.
|
128
138
|
#
|
129
139
|
# This method is abstract in the sense that it relies on +find_target+,
|
@@ -24,7 +24,7 @@ module ActiveRecord
|
|
24
24
|
alias_tracker = AliasTracker.create connection, association.klass.table_name, klass.type_caster
|
25
25
|
chain_head, chain_tail = get_chain(reflection, association, alias_tracker)
|
26
26
|
|
27
|
-
scope.extending!
|
27
|
+
scope.extending! reflection.extensions
|
28
28
|
add_constraints(scope, owner, klass, reflection, chain_head, chain_tail)
|
29
29
|
end
|
30
30
|
|
@@ -8,7 +8,16 @@ module ActiveRecord::Associations::Builder # :nodoc:
|
|
8
8
|
|
9
9
|
def self.define_accessors(model, reflection)
|
10
10
|
super
|
11
|
-
|
11
|
+
mixin = model.generated_association_methods
|
12
|
+
name = reflection.name
|
13
|
+
|
14
|
+
define_constructors(mixin, name) if reflection.constructable?
|
15
|
+
|
16
|
+
mixin.class_eval <<-CODE, __FILE__, __LINE__ + 1
|
17
|
+
def reload_#{name}
|
18
|
+
association(:#{name}).force_reload_reader
|
19
|
+
end
|
20
|
+
CODE
|
12
21
|
end
|
13
22
|
|
14
23
|
# Defines the (build|create)_association methods for belongs_to or has_one association
|