2016-09-23 09:50:39 +00:00
|
|
|
* Return `true` from `update_attribute` when the value of the attribute
|
|
|
|
to be updated is unchanged.
|
|
|
|
|
|
|
|
Fixes #26593.
|
|
|
|
|
|
|
|
*Prathamesh Sonpatki*
|
|
|
|
|
2016-09-19 22:37:42 +00:00
|
|
|
* Always store errors details information with symbols.
|
|
|
|
|
|
|
|
When the association is autosaved we were storing the details with
|
|
|
|
string keys. This was creating inconsistency with other details that are
|
|
|
|
added using the `Errors#add` method. It was also inconsistent with the
|
|
|
|
`Errors#messages` storage.
|
|
|
|
|
|
|
|
To fix this inconsistency we are always storing with symbols. This will
|
|
|
|
cause a small breaking change because in those cases the details could
|
|
|
|
be accessed as strings keys but now it can not.
|
|
|
|
|
|
|
|
Fix #26499.
|
|
|
|
|
|
|
|
*Rafael Mendonça França*, *Marcus Vieira*
|
|
|
|
|
2016-09-14 15:07:15 +00:00
|
|
|
* Calling `touch` on a model using optimistic locking will now leave the model
|
|
|
|
in a non-dirty state with no attribute changes.
|
|
|
|
|
|
|
|
Fixes #26496.
|
|
|
|
|
|
|
|
*Jakob Skjerning*
|
|
|
|
|
2016-09-13 18:17:06 +00:00
|
|
|
* Using a mysql2 connection after it fails to reconnect will now have an error message
|
|
|
|
saying the connection is closed rather than an undefined method error message.
|
|
|
|
|
|
|
|
*Dylan Thacker-Smith*
|
|
|
|
|
2016-08-31 16:06:30 +00:00
|
|
|
* PostgreSQL array columns will now respect the encoding of strings contained
|
|
|
|
in the array.
|
|
|
|
|
|
|
|
Fixes #26326.
|
|
|
|
|
|
|
|
*Sean Griffin*
|
|
|
|
|
2016-08-31 12:54:38 +00:00
|
|
|
* Inverse association instances will now be set before `after_find` or
|
|
|
|
`after_initialize` callbacks are run.
|
|
|
|
|
|
|
|
Fixes #26320.
|
|
|
|
|
|
|
|
*Sean Griffin*
|
|
|
|
|
2016-02-05 15:16:15 +00:00
|
|
|
* Remove unnecessarily association load when a `belongs_to` association has already been
|
|
|
|
loaded then the foreign key is changed directly and the record saved.
|
|
|
|
|
|
|
|
*James Coleman*
|
|
|
|
|
2016-08-22 18:46:04 +00:00
|
|
|
* Remove standardized column types/arguments spaces in schema dump.
|
2016-07-01 09:24:12 +00:00
|
|
|
|
|
|
|
*Tim Petricola*
|
|
|
|
|
2016-08-19 04:08:09 +00:00
|
|
|
* Avoid loading records from database when they are already loaded using
|
|
|
|
the `pluck` method on a collection.
|
|
|
|
|
|
|
|
Fixes #25921.
|
|
|
|
|
|
|
|
*Ryuta Kamizono*
|
|
|
|
|
2016-08-13 21:17:20 +00:00
|
|
|
* Remove text default treated as an empty string in non-strict mode for
|
|
|
|
consistency with other types.
|
|
|
|
|
|
|
|
Strict mode controls how MySQL handles invalid or missing values in
|
|
|
|
data-change statements such as INSERT or UPDATE. If strict mode is not
|
|
|
|
in effect, MySQL inserts adjusted values for invalid or missing values
|
|
|
|
and produces warnings.
|
|
|
|
|
|
|
|
def test_mysql_not_null_defaults_non_strict
|
|
|
|
using_strict(false) do
|
|
|
|
with_mysql_not_null_table do |klass|
|
|
|
|
record = klass.new
|
|
|
|
assert_nil record.non_null_integer
|
|
|
|
assert_nil record.non_null_string
|
|
|
|
assert_nil record.non_null_text
|
|
|
|
assert_nil record.non_null_blob
|
|
|
|
|
|
|
|
record.save!
|
|
|
|
record.reload
|
|
|
|
|
|
|
|
assert_equal 0, record.non_null_integer
|
|
|
|
assert_equal "", record.non_null_string
|
|
|
|
assert_equal "", record.non_null_text
|
|
|
|
assert_equal "", record.non_null_blob
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sql-mode-strict
|
|
|
|
|
|
|
|
*Ryuta Kamizono*
|
|
|
|
|
Added nil case handling to allow rollback migration in case of
invalid column type
/activerecord/lib/active_record/connection_adapters
/abstract/schema_definitions.rb:306
type = type.to_sym
Changed to the following to handle nil case:
type = type.to_sym if type
Added regression test for this case:
/activerecord/test/cases/migration_test.rb:554
if current_adapter?(:SQLite3Adapter)
def test_allows_sqlite3_rollback_on_invalid_column_type
Person.connection.create_table :something, force: true do |t|
t.column :number, :integer
t.column :name, :string
t.column :foo, :bar
end
assert Person.connection.column_exists?(:something, :foo)
assert_nothing_raised { Person.connection.remove_column :something, :foo, :bar }
assert !Person.connection.column_exists?(:something, :foo)
assert Person.connection.column_exists?(:something, :name)
assert Person.connection.column_exists?(:something, :number)
ensure
Person.connection.drop_table :something, if_exists: true
end
end
2016-08-18 00:21:54 +00:00
|
|
|
* Sqlite3 migrations to add a column to an existing table can now be
|
|
|
|
successfully rolled back when the column was given and invalid column
|
|
|
|
type.
|
|
|
|
|
|
|
|
Fixes #26087
|
|
|
|
|
|
|
|
*Travis O'Neill*
|
|
|
|
|
2016-07-31 04:11:30 +00:00
|
|
|
* Deprecate `sanitize_conditions`. Use `sanitize_sql` instead.
|
|
|
|
|
|
|
|
*Ryuta Kamizono*
|
|
|
|
|
2016-08-10 21:27:32 +00:00
|
|
|
* Doing count on relations that contain LEFT OUTER JOIN Arel node no longer
|
|
|
|
force a DISTINCT. This solves issues when using count after a left_joins.
|
|
|
|
|
|
|
|
*Maxime Handfield Lapointe*
|
|
|
|
|
2016-07-30 13:19:30 +00:00
|
|
|
* RecordNotFound raised by association.find exposes `id`, `primary_key` and
|
|
|
|
`model` methods to be consistent with RecordNotFound raised by Record.find.
|
|
|
|
|
|
|
|
*Michel Pigassou*
|
|
|
|
|
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 13:39:46 +00: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-28 02:19:08 +00:00
|
|
|
* Fix the SELECT statement in `#table_comment` for MySQL.
|
|
|
|
|
|
|
|
*Takeshi Akima*
|
|
|
|
|
2016-07-25 15:13:01 +00:00
|
|
|
* Virtual attributes will no longer raise when read on models loaded from the
|
|
|
|
database
|
|
|
|
|
|
|
|
*Sean Griffin*
|
|
|
|
|
2016-07-14 16:12:53 +00:00
|
|
|
* Support calling the method `merge` in `scope`'s lambda.
|
|
|
|
|
|
|
|
*Yasuhiro Sugino*
|
|
|
|
|
2016-07-14 19:12:11 +00:00
|
|
|
* Fixes multi-parameter attributes conversion with invalid params.
|
|
|
|
|
|
|
|
*Hiroyuki Ishii*
|
|
|
|
|
2016-07-10 16:43:12 +00:00
|
|
|
* Add newline between each migration in `structure.sql`.
|
2016-07-13 15:44:37 +00:00
|
|
|
|
|
|
|
Keeps schema migration inserts as a single commit, but allows for easier
|
2016-07-10 16:43:12 +00:00
|
|
|
git diffing.
|
|
|
|
|
|
|
|
Fixes #25504.
|
2016-07-13 15:44:37 +00:00
|
|
|
|
|
|
|
*Grey Baker*, *Norberto Lopes*
|
|
|
|
|
2016-07-13 16:21:41 +00: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 14:43:02 +00:00
|
|
|
* Using `group` with an attribute that has a custom type will properly cast
|
Added nil case handling to allow rollback migration in case of
invalid column type
/activerecord/lib/active_record/connection_adapters
/abstract/schema_definitions.rb:306
type = type.to_sym
Changed to the following to handle nil case:
type = type.to_sym if type
Added regression test for this case:
/activerecord/test/cases/migration_test.rb:554
if current_adapter?(:SQLite3Adapter)
def test_allows_sqlite3_rollback_on_invalid_column_type
Person.connection.create_table :something, force: true do |t|
t.column :number, :integer
t.column :name, :string
t.column :foo, :bar
end
assert Person.connection.column_exists?(:something, :foo)
assert_nothing_raised { Person.connection.remove_column :something, :foo, :bar }
assert !Person.connection.column_exists?(:something, :foo)
assert Person.connection.column_exists?(:something, :name)
assert Person.connection.column_exists?(:something, :number)
ensure
Person.connection.drop_table :something, if_exists: true
end
end
2016-08-18 00:21:54 +00:00
|
|
|
the hash keys after calling a calculation method like `count`.
|
|
|
|
|
2016-08-10 04:02:22 +00:00
|
|
|
Fixes #25595.
|
2016-07-11 14:43:02 +00:00
|
|
|
|
|
|
|
*Sean Griffin*
|
|
|
|
|
2016-07-09 12:21:31 +00:00
|
|
|
* Fix the generated `#to_param` method to use `omission: ''` so that
|
2016-02-11 19:22:09 +00: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 12:21:31 +00:00
|
|
|
Fixes #23635.
|
2016-02-11 19:22:09 +00:00
|
|
|
|
|
|
|
*Rob Biedenharn*
|
|
|
|
|
2016-07-05 23:07:26 +00:00
|
|
|
* Ensure concurrent invocations of the connection reaper cannot allocate the
|
|
|
|
same connection to two threads.
|
|
|
|
|
|
|
|
Fixes #25585.
|
|
|
|
|
|
|
|
*Matthew Draper*
|
|
|
|
|
2016-06-28 18:54:17 +00: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 13:46:45 +00:00
|
|
|
* Removed the unused methods `ActiveRecord::Base.connection_id` and
|
2016-07-09 12:21:31 +00:00
|
|
|
`ActiveRecord::Base.connection_id=`.
|
2016-06-29 13:46:45 +00:00
|
|
|
|
|
|
|
*Sean Griffin*
|
|
|
|
|
2016-05-31 13:56:19 +00:00
|
|
|
* Ensure hashes can be assigned to attributes created using `composed_of`.
|
Added nil case handling to allow rollback migration in case of
invalid column type
/activerecord/lib/active_record/connection_adapters
/abstract/schema_definitions.rb:306
type = type.to_sym
Changed to the following to handle nil case:
type = type.to_sym if type
Added regression test for this case:
/activerecord/test/cases/migration_test.rb:554
if current_adapter?(:SQLite3Adapter)
def test_allows_sqlite3_rollback_on_invalid_column_type
Person.connection.create_table :something, force: true do |t|
t.column :number, :integer
t.column :name, :string
t.column :foo, :bar
end
assert Person.connection.column_exists?(:something, :foo)
assert_nothing_raised { Person.connection.remove_column :something, :foo, :bar }
assert !Person.connection.column_exists?(:something, :foo)
assert Person.connection.column_exists?(:something, :name)
assert Person.connection.column_exists?(:something, :number)
ensure
Person.connection.drop_table :something, if_exists: true
end
end
2016-08-18 00:21:54 +00:00
|
|
|
|
2016-05-31 13:56:19 +00:00
|
|
|
Fixes #25210.
|
|
|
|
|
|
|
|
*Sean Griffin*
|
|
|
|
|
2016-05-21 12:51:36 +00:00
|
|
|
* Fix logging edge case where if an attribute was of the binary type and
|
|
|
|
was provided as a Hash.
|
2016-05-21 12:55:06 +00:00
|
|
|
|
2016-05-21 12:51:36 +00:00
|
|
|
*Jon Moss*
|
|
|
|
|
2016-02-22 16:36:08 +00:00
|
|
|
* Handle JSON deserialization correctly if the column default from database
|
|
|
|
adapter returns `''` instead of `nil`.
|
|
|
|
|
|
|
|
*Johannes Opper*
|
2016-05-06 21:54:40 +00:00
|
|
|
|
2016-07-09 12:21:31 +00:00
|
|
|
* Introduce `ActiveRecord::TransactionSerializationError` for catching
|
2016-05-21 11:25:01 +00:00
|
|
|
transaction serialization failures or deadlocks.
|
|
|
|
|
|
|
|
*Erol Fornoles*
|
|
|
|
|
2016-08-10 04:02:22 +00:00
|
|
|
* PostgreSQL: Fix `db:structure:load` silent failure on SQL error.
|
2016-05-10 17:44:33 +00:00
|
|
|
|
2016-07-09 12:21:31 +00: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 17:44:33 +00:00
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
psql -v ON_ERROR_STOP=1 -q -f awesome-file.sql my-app-db
|
|
|
|
|
|
|
|
Fixes #23818.
|
|
|
|
|
|
|
|
*Ralin Chimev*
|
|
|
|
|
|
|
|
|
2016-05-10 04:07:09 +00:00
|
|
|
Please check [5-0-stable](https://github.com/rails/rails/blob/5-0-stable/activerecord/CHANGELOG.md) for previous changes.
|