aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r--activerecord/CHANGELOG.md266
1 files changed, 261 insertions, 5 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index d289f616b8..f1f9cf1ffd 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,8 +1,264 @@
+* Properly detect if a connection is still active before using it
+ in multi-threaded environments.
+
+ Fixes #12867.
+
+ *Kevin Casey*, *Matthew Draper*, *William (B.J.) Snow Orvis*
+
+* When inverting add_index use the index name if present instead of
+ the columns.
+
+ If there are two indices with matching columns and one of them is
+ explicitly named then reverting the migration adding the named one
+ would instead drop the unnamed one.
+
+ The inversion of add_index will now drop the index by its name if
+ it is present.
+
+ *Hubert Dąbrowski*
+
+* Add flag to disable schema dump after migration.
+
+ Add a config parameter on Active Record named `dump_schema_after_migration`
+ which is true by default. Now schema dump does not happen at the
+ end of migration rake task if `dump_schema_after_migration` is false.
+
+ *Emil Soman*
+
+* `find_in_batches`, `find_each`, `Result#each` and `Enumerable#index_by` now
+ return an `Enumerator` that can calculate its size.
+
+ See also #13938.
+
+ *Marc-André Lafortune*
+
+* Make sure transaction state gets reset after a commit operation on the record.
+
+ If a new transaction was open inside a callback, the record was loosing track
+ of the transaction level state, and it was leaking that state.
+
+ Fixes #12566.
+
+ *arthurnn*
+
+* Pass `has_and_belongs_to_many` `:autosave` option to
+ the underlying `has_many :through` association.
+
+ Fixes #13923.
+
+ *Yves Senn*
+
+* PostgreSQL implementation of `SchemaStatements#index_name_exists?`.
+
+ The database agnostic implementation does not detect with indexes that are
+ not supported by the ActiveRecord schema dumper. For example, expressions
+ indexes would not be detected.
+
+ Fixes #11018.
+
+ *Jonathan Baudanza*
+
+* Parsing PostgreSQL arrays with empty strings now works correctly.
+
+ Previously, if you tried to parse `{"1","","2","","3"}` the result
+ would be `["1","2","3"]`, removing the empty strings from the array,
+ which would be incorrect. Now it will correctly produce `["1","","2","","3"]`
+ as the result of parsing the above PostgreSQL array.
+
+ Fixes #13907.
+
+ *Maurício Linhares*
+
+* Associations now raise `ArgumentError` on name conflicts.
+
+ Dangerous association names conflicts include instance or class methods already
+ defined by `ActiveRecord::Base`.
+
+ Example:
+
+ class Car < ActiveRecord::Base
+ has_many :errors
+ end
+ # Will raise ArgumentError.
+
+ Fixes #13217.
+
+ *Lauro Caetano*
+
+* Fix regressions on `select_*` methods.
+ When `select_*` methods receive a `Relation` object, they should be able to
+ get the arel/binds from it.
+ Also fix regressions on `select_rows` that was ignoring the binds.
+
+ Fixes #7538, #12017, #13731, #12056.
+
+ *arthurnn*
+
+* Active Record objects can now be correctly dumped, loaded and dumped again
+ without issues.
+
+ Previously, if you did `YAML.dump`, `YAML.load` and then `YAML.dump` again
+ in an Active Record model that used serialization it would fail at the last
+ dump due to the fields not being correctly serialized before being dumped
+ to YAML. Now it is possible to dump and load the same object as many times
+ as needed without any issues.
+
+ Fixes #13861.
+
+ *Maurício Linhares*
+
+* `find_in_batches` now returns an `Enumerator` when called without a block, so that it
+ can be chained with other `Enumerable` methods.
+
+ *Marc-André Lafortune*
+
+* `enum` now raises on "dangerous" name conflicts.
+
+ Dangerous name conflicts includes instance or class method conflicts
+ with methods defined within `ActiveRecord::Base` but not its ancestors,
+ as well as conflicts with methods generated by other enums on the same
+ class.
+
+ Fixes #13389.
+
+ *Godfrey Chan*
+
+* `scope` now raises on "dangerous" name conflicts.
+
+ Similar to dangerous attribute methods, a scope name conflict is
+ dangerous if it conflicts with an existing class method defined within
+ `ActiveRecord::Base` but not its ancestors.
+
+ See also #13389.
+
+ *Godfrey Chan*, *Philippe Creux*
+
+* Correctly send an user provided statement to a `lock!()` call.
+
+ person.lock! 'FOR SHARE NOWAIT'
+ # Before: SELECT * ... LIMIT 1 FOR UPDATE
+ # After: SELECT * ... LIMIT 1 FOR SHARE NOWAIT
+
+ Fixes #13788.
+
+ *Maurício Linhares*
+
+* Handle aliased attributes `select()`, `order()` and `reorder()`.
+
+ *Tsutomu Kuroda*
+
+* Reset the collection association when calling `reset` on it.
+
+ Before:
+
+ post.comments.loaded? # => true
+ post.comments.reset
+ post.comments.loaded? # => true
+
+ After:
+
+ post.comments.loaded? # => true
+ post.comments.reset
+ post.comments.loaded? # => false
+
+ Fixes #13777.
+
+ *Kelsey Schlarman*
+
+* Make enum fields work as expected with the `ActiveModel::Dirty` API.
+
+ Before this change, using the dirty API would have surprising results:
+
+ conversation = Conversation.new
+ conversation.status = :active
+ conversation.status = :archived
+ conversation.status_was # => 0
+
+ After this change, the same code would result in:
+
+ conversation = Conversation.new
+ conversation.status = :active
+ conversation.status = :archived
+ conversation.status_was # => "active"
+
+ *Rafael Mendonça França*
+
+* `has_one` and `belongs_to` accessors don't add ORDER BY to the queries
+ anymore.
+
+ Since Rails 4.0, we add an ORDER BY in the `first` method to ensure
+ consistent results among different database engines. But for singular
+ associations this behavior is not needed since we will have one record to
+ return. As this ORDER BY option can lead some performance issues we are
+ removing it for singular associations accessors.
+
+ Fixes #12623.
+
+ *Rafael Mendonça França*
+
+* Prepend table name for column names passed to `Relation#select`.
+
+ Example:
+
+ Post.select(:id)
+ # Before: => SELECT id FROM "posts"
+ # After: => SELECT "posts"."id" FROM "posts"
+
+ *Yves Senn*
+
+* Fail early with "Primary key not included in the custom select clause"
+ in `find_in_batches`.
+
+ Before this patch, the exception was raised after the first batch was
+ yielded to the block. This means that you only get it, when you hit the
+ `batch_size` treshold. This could shadow the issue in development.
+
+ *Alexander Balashov*
+
+* Ensure `second` through `fifth` methods act like the `first` finder.
+
+ The famous ordinal Array instance methods defined in ActiveSupport
+ (`first`, `second`, `third`, `fourth`, and `fifth`) are now available as
+ full-fledged finders in ActiveRecord. The biggest benefit of this is ordering
+ of the records returned now defaults to the table's primary key in ascending order.
+
+ Fixes #13743.
+
+ Example:
+
+ User.all.second
+
+ # Before
+ # => 'SELECT "users".* FROM "users"'
+
+ # After
+ # => SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1 OFFSET 1'
+
+ User.offset(3).second
+
+ # Before
+ # => 'SELECT "users".* FROM "users" LIMIT -1 OFFSET 3' # sqlite3 gem
+ # => 'SELECT "users".* FROM "users" OFFSET 3' # pg gem
+ # => 'SELECT `users`.* FROM `users` LIMIT 18446744073709551615 OFFSET 3' # mysql2 gem
+
+ # After
+ # => SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1 OFFSET 4'
+
+ *Jason Meller*
+
+* ActiveRecord states are now correctly restored after a rollback for
+ models that did not define any transactional callbacks (i.e.
+ `after_commit`, `after_rollback` or `after_create`).
+
+ Fixes #13744.
+
+ *Godfrey Chan*
+
* Make `touch` fire the `after_commit` and `after_rollback` callbacks.
*Harry Brundage*
-* Enable partial indexes for sqlite >= 3.8.0
+* Enable partial indexes for `sqlite >= 3.8.0`.
See http://www.sqlite.org/partialindex.html
@@ -130,7 +386,7 @@
This ensures that `change_table` and `create_table` will use
similar objects.
- Fixes #13577 and #13503.
+ Fixes #13577, #13503.
*Nishant Modak*, *Prathamesh Sonpatki*, *Rafael Mendonça França*
@@ -675,7 +931,7 @@
*Severin Schoepke*
-* `ActiveRecord::Store` works together with PG `hstore` columns.
+* `ActiveRecord::Store` works together with PostgreSQL `hstore` columns.
Fixes #12452.
@@ -961,7 +1217,7 @@
*Yves Senn* , *Severin Schoepke*
-* Fix multidimensional PG arrays containing non-string items.
+* Fix multidimensional PostgreSQL arrays containing non-string items.
*Yves Senn*
@@ -979,7 +1235,7 @@
*Richard Schneeman*
-* Removed redundant override of `xml` column definition for PG,
+* Removed redundant override of `xml` column definition for PostgreSQL,
in order to use `xml` column type instead of `text`.
*Paul Nikitochkin*, *Michael Nikitochkin*