diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-02-17 11:21:18 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-02-17 11:21:18 -0800 |
commit | fe42effb11a97cf19777d7b0dba7e1e2dfd3316c (patch) | |
tree | 388f48bc682802cbcae53a0d570d2c8587bbb98b /activerecord/CHANGELOG.md | |
parent | 5ac2879b08b05b7f6eaebc5473e62b4576f84a3f (diff) | |
parent | 3e3ed1ede51f4d2f7f1d30b3754072b1121d5394 (diff) | |
download | rails-fe42effb11a97cf19777d7b0dba7e1e2dfd3316c.tar.gz rails-fe42effb11a97cf19777d7b0dba7e1e2dfd3316c.tar.bz2 rails-fe42effb11a97cf19777d7b0dba7e1e2dfd3316c.zip |
Merge branch 'master' into adequaterecord
* master: (311 commits)
Add a missing changelog entry for #13981 and #14035
Revert "Fixed plugin_generator test"
implements new option :month_format_string for date select helpers [Closes #13618]
add factory methods for empty alias trackers
guarantee a list in the alias tracker so we can remove a conditional
stop exposing table_joins
make most parameters to the AliasTracker required
make a singleton for AssociationScope
pass the association and connection to the scope method
pass the tracker down the stack and construct it in the scope method
clean up add_constraints signature
remove the reflection delegate
remove klass delegator
remove railties changes. fixes #14054
remove chain delegate
remove scope_chain delegate
Add verb to sanitization note
fix path shown in mailer's templates
updated Travis build status image url
fix guide active_support_core_extensions. add Note to String#indent [ci skip]
...
Conflicts:
activerecord/lib/active_record/associations/join_dependency.rb
activerecord/test/cases/associations/association_scope_test.rb
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r-- | activerecord/CHANGELOG.md | 266 |
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* |