diff options
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r-- | activerecord/CHANGELOG.md | 88 |
1 files changed, 71 insertions, 17 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index e15756e834..9f64941065 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,4 +1,70 @@ -* Allow for the name of the schema_migrations table to be configured. +* Log bind variables after they are type casted. This makes it more + transparent what values are actually sent to the database. + + irb(main):002:0> Event.find("im-no-integer") + # Before: ... WHERE "events"."id" = $1 LIMIT 1 [["id", "im-no-integer"]] + # After: ... WHERE "events"."id" = $1 LIMIT 1 [["id", 0]] + + *Yves Senn* + +* Fix uninitialized constant `TransactionState` error when `Marshall.load` is used on an Active Record result. + Fixes #12790 + + *Jason Ayre* + +* `.unscope` now removes conditions specified in `default_scope`. + + *Jon Leighton* + +* Added `ActiveRecord::QueryMethods#rewhere` which will overwrite an existing, named where condition. + + Examples: + + Post.where(trashed: true).where(trashed: false) #=> WHERE `trashed` = 1 AND `trashed` = 0 + Post.where(trashed: true).rewhere(trashed: false) #=> WHERE `trashed` = 0 + Post.where(active: true).where(trashed: true).rewhere(trashed: false) #=> WHERE `active` = 1 AND `trashed` = 0 + + *DHH* + +* Extend `ActiveRecord::Base#cache_key` to take an optional list of timestamp attributes of which the highest will be used. + + Example: + + # last_reviewed_at will be used, if that's more recent than updated_at, or vice versa + Person.find(5).cache_key(:updated_at, :last_reviewed_at) + + *DHH* + +* Added `ActiveRecord::Base#enum` for declaring enum attributes where the values map to integers in the database, but can be queried by name. + + Example: + + class Conversation < ActiveRecord::Base + enum status: [:active, :archived] + end + + Conversation::STATUS # => { active: 0, archived: 1 } + + # conversation.update! status: 0 + conversation.active! + conversation.active? # => true + conversation.status # => "active" + + # conversation.update! status: 1 + conversation.archived! + conversation.archived? # => true + conversation.status # => "archived" + + # conversation.update! status: 1 + conversation.status = :archived + + *DHH* + +* `ActiveRecord::Base#attribute_for_inspect` now truncates long arrays (more than 10 elements). + + *Jan Bernacki* + +* Allow for the name of the `schema_migrations` table to be configured. *Jerad Phelps* @@ -6,6 +72,7 @@ Fixed bug when providing `includes` in through association scope, and fetching targets. Example: + class Vendor < ActiveRecord::Base has_many :relationships, -> { includes(:user) } has_many :users, through: :relationships @@ -21,8 +88,7 @@ vendor.users.to_a # => No exception is raised - - Fixes: #12242, #9517, #10240 + Fixes #12242, #9517, #10240. *Paul Nikitochkin* @@ -210,18 +276,6 @@ *kennyj* -* ActiveRecord::Base#<=> has been removed. Primary keys may not be in order, - or even be numbers, so sorting by id doesn't make sense. Please use `sort_by` - and specify the attribute you wish to sort with. For example, change: - - Post.all.to_a.sort - - to: - - Post.all.to_a.sort_by(&:id) - - *Aaron Patterson* - * Fix: joins association, with defined in the scope block constraints by using several where constraints and at least of them is not `Arel::Nodes::Equality`, generates invalid SQL expression. @@ -541,11 +595,11 @@ Method `delete_all` should not be invoking callbacks and this feature was deprecated in Rails 4.0. This is being removed. `delete_all` will continue to honor the `:dependent` option. However - if `:dependent` value is `:destroy` then the default deletion + if `:dependent` value is `:destroy` then the `:delete_all` deletion strategy for that collection will be applied. User can also force a deletion strategy by passing parameter to - `delete_all`. For example you can do `@post.comments.delete_all(:nullify)` . + `delete_all`. For example you can do `@post.comments.delete_all(:nullify)`. *Neeraj Singh* |