Don't assume all hashes are from multiparameter assignment in `composed_of`
So this bug is kinda funky. The code path is basically "if we weren't passed an
instance of the class we compose to, and we have a converter, call that".
Ignoring the hash case for a moment, everything after that was roughly intended
to be the "else" clause, meaning that we are expected to have an instance of
the class we compose to. Really, we should be blowing up in that case, as we
can give a much better error message than what they user will likely get (e.g.
`NameError: No method first for String` or something). Still, Ruby is duck
typed, so if the object you're assigning responds to the same methods as the
type you compose to, knock yourself out.
The hash case was added in 36e9be8 to remove a bunch of special cased code from
multiparameter assignment. I wrongly assumed that the only time we'd get a hash
there is in that case. Multiparameter assignment will construct a very specific
hash though, where the keys are integers, and we will have a set of keys
covering `1..part.size` exactly. I'm pretty sure this could actually be passed
around as an array, but that's a different story. Really I should convert this
to something like `class MultiParameterAssignment < Hash; end`, which I might
do soon. However for a change that I'm willing to backport to 4-2-stable, this
is what I want to go with for the time being.
Fixes #25978
2016-08-05 09:39:46 -04:00
|
|
|
* Hashes can once again be passed to setters of `composed_of`, if all of the
|
|
|
|
mapping methods are methods implemented on `Hash`.
|
|
|
|
|
|
|
|
Fixes #25978.
|
|
|
|
|
|
|
|
*Sean Griffin*
|
|
|
|
|
2016-07-27 22:19:08 -04:00
|
|
|
* Fix the SELECT statement in `#table_comment` for MySQL.
|
|
|
|
|
|
|
|
*Takeshi Akima*
|
|
|
|
|
2016-07-25 11:13:01 -04:00
|
|
|
* Virtual attributes will no longer raise when read on models loaded from the
|
|
|
|
database
|
|
|
|
|
|
|
|
*Sean Griffin*
|
|
|
|
|
2016-07-14 12:12:53 -04:00
|
|
|
* Support calling the method `merge` in `scope`'s lambda.
|
|
|
|
|
|
|
|
*Yasuhiro Sugino*
|
|
|
|
|
2016-07-14 15:12:11 -04:00
|
|
|
* Fixes multi-parameter attributes conversion with invalid params.
|
|
|
|
|
|
|
|
*Hiroyuki Ishii*
|
|
|
|
|
2016-07-10 12:43:12 -04:00
|
|
|
* Add newline between each migration in `structure.sql`.
|
2016-07-13 11:44:37 -04:00
|
|
|
|
|
|
|
Keeps schema migration inserts as a single commit, but allows for easier
|
2016-07-10 12:43:12 -04:00
|
|
|
git diffing.
|
|
|
|
|
|
|
|
Fixes #25504.
|
2016-07-13 11:44:37 -04:00
|
|
|
|
|
|
|
*Grey Baker*, *Norberto Lopes*
|
|
|
|
|
2016-07-13 12:21:41 -04:00
|
|
|
* The flag `error_on_ignored_order_or_limit` has been deprecated in favor of
|
|
|
|
the current `error_on_ignored_order`.
|
|
|
|
|
|
|
|
*Xavier Noria*
|
|
|
|
|
|
|
|
* Batch processing methods support `limit`:
|
|
|
|
|
|
|
|
Post.limit(10_000).find_each do |post|
|
|
|
|
# ...
|
|
|
|
end
|
|
|
|
|
|
|
|
It also works in `find_in_batches` and `in_batches`.
|
|
|
|
|
|
|
|
*Xavier Noria*
|
|
|
|
|
2016-07-11 10:43:02 -04:00
|
|
|
* Using `group` with an attribute that has a custom type will properly cast
|
2016-08-10 00:02:22 -04:00
|
|
|
the hash keys after calling a calculation method like `count`.
|
|
|
|
|
|
|
|
Fixes #25595.
|
2016-07-11 10:43:02 -04:00
|
|
|
|
|
|
|
*Sean Griffin*
|
|
|
|
|
2016-07-09 08:21:31 -04:00
|
|
|
* Fix the generated `#to_param` method to use `omission: ''` so that
|
2016-02-11 14:22:09 -05:00
|
|
|
the resulting output is actually up to 20 characters, not
|
|
|
|
effectively 17 to leave room for the default "...".
|
|
|
|
Also call `#parameterize` before `#truncate` and make the
|
|
|
|
`separator: /-/` to maximize the information included in the
|
|
|
|
output.
|
|
|
|
|
2016-07-09 08:21:31 -04:00
|
|
|
Fixes #23635.
|
2016-02-11 14:22:09 -05:00
|
|
|
|
|
|
|
*Rob Biedenharn*
|
|
|
|
|
2016-07-05 19:07:26 -04:00
|
|
|
* Ensure concurrent invocations of the connection reaper cannot allocate the
|
|
|
|
same connection to two threads.
|
|
|
|
|
|
|
|
Fixes #25585.
|
|
|
|
|
|
|
|
*Matthew Draper*
|
|
|
|
|
2016-06-28 14:54:17 -04:00
|
|
|
* Inspecting an object with an associated array of over 10 elements no longer
|
|
|
|
truncates the array, preventing `inspect` from looping infinitely in some
|
|
|
|
cases.
|
|
|
|
|
|
|
|
*Kevin McPhillips*
|
|
|
|
|
2016-06-29 09:46:45 -04:00
|
|
|
* Removed the unused methods `ActiveRecord::Base.connection_id` and
|
2016-07-09 08:21:31 -04:00
|
|
|
`ActiveRecord::Base.connection_id=`.
|
2016-06-29 09:46:45 -04:00
|
|
|
|
|
|
|
*Sean Griffin*
|
|
|
|
|
2016-05-31 09:56:19 -04:00
|
|
|
* Ensure hashes can be assigned to attributes created using `composed_of`.
|
2016-08-10 00:02:22 -04:00
|
|
|
|
2016-05-31 09:56:19 -04:00
|
|
|
Fixes #25210.
|
|
|
|
|
|
|
|
*Sean Griffin*
|
|
|
|
|
2016-05-21 08:51:36 -04:00
|
|
|
* Fix logging edge case where if an attribute was of the binary type and
|
|
|
|
was provided as a Hash.
|
2016-05-21 08:55:06 -04:00
|
|
|
|
2016-05-21 08:51:36 -04:00
|
|
|
*Jon Moss*
|
|
|
|
|
2016-02-22 11:36:08 -05:00
|
|
|
* Handle JSON deserialization correctly if the column default from database
|
|
|
|
adapter returns `''` instead of `nil`.
|
|
|
|
|
|
|
|
*Johannes Opper*
|
2016-05-06 17:54:40 -04:00
|
|
|
|
2016-07-09 08:21:31 -04:00
|
|
|
* Introduce `ActiveRecord::TransactionSerializationError` for catching
|
2016-05-21 07:25:01 -04:00
|
|
|
transaction serialization failures or deadlocks.
|
|
|
|
|
|
|
|
*Erol Fornoles*
|
|
|
|
|
2016-08-10 00:02:22 -04:00
|
|
|
* PostgreSQL: Fix `db:structure:load` silent failure on SQL error.
|
2016-05-10 13:44:33 -04:00
|
|
|
|
2016-07-09 08:21:31 -04:00
|
|
|
The command line flag `-v ON_ERROR_STOP=1` should be used
|
|
|
|
when invoking `psql` to make sure errors are not suppressed.
|
2016-05-10 13:44:33 -04:00
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
psql -v ON_ERROR_STOP=1 -q -f awesome-file.sql my-app-db
|
|
|
|
|
|
|
|
Fixes #23818.
|
|
|
|
|
|
|
|
*Ralin Chimev*
|
|
|
|
|
|
|
|
|
2016-05-10 00:07:09 -04:00
|
|
|
Please check [5-0-stable](https://github.com/rails/rails/blob/5-0-stable/activerecord/CHANGELOG.md) for previous changes.
|