diff options
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r-- | activerecord/CHANGELOG.md | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 97616ffc58..49f7b03464 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,5 +1,124 @@ ## Rails 4.0.0 (unreleased) ## +* When copying migrations, preserve their magic comments and content encoding. + + *OZAWA Sakuro* + +* Fix ActiveRecord `subclass_from_attrs` when `eager_load` is false. + It cannot find subclass because all classes are loaded automatically + when it needs. + + *Dmitry Vorotilin* + +* When `:name` option is provided to `remove_index`, use it if there is no + index by the conventional name. + + For example, previously if an index was removed like so + `remove_index :values, column: :value, name: 'a_different_name'` + the generated SQL would not contain the specified index name, + and hence the migration would fail. + Fixes #8858. + + *Ezekiel Smithburg* + +* Created block to by-pass the prepared statement bindings. + This will allow to compose fragments of large SQL statements to + avoid multiple round-trips between Ruby and the DB. + + Example: + + sql = Post.connection.unprepared_statement do + Post.first.comments.to_sql + end + + *Cédric Fabianski* + +* Change the semantics of combining scopes to be the same as combining + class methods which return scopes. For example: + + class User < ActiveRecord::Base + scope :active, -> { where state: 'active' } + scope :inactive, -> { where state: 'inactive' } + end + + class Post < ActiveRecord::Base + def self.active + where state: 'active' + end + + def self.inactive + where state: 'inactive' + end + end + + ### BEFORE ### + + User.where(state: 'active').where(state: 'inactive') + # => SELECT * FROM users WHERE state = 'active' AND state = 'inactive' + + User.active.inactive + # => SELECT * FROM users WHERE state = 'inactive' + + Post.active.inactive + # => SELECT * FROM posts WHERE state = 'active' AND state = 'inactive' + + ### AFTER ### + + User.active.inactive + # => SELECT * FROM posts WHERE state = 'active' AND state = 'inactive' + + Before this change, invoking a scope would merge it into the current + scope and return the result. `Relation#merge` applies "last where + wins" logic to de-duplicate the conditions, but this lead to + confusing and inconsistent behaviour. This fixes that. + + If you really do want the "last where wins" logic, you can opt-in to + it like so: + + User.active.merge(User.inactive) + + Fixes #7365. + + *Neeraj Singh* and *Jon Leighton* + +* Expand `#cache_key` to consult all relevant updated timestamps. + + Previously only `updated_at` column was checked, now it will + consult other columns that received updated timestamps on save, + such as `updated_on`. When multiple columns are present it will + use the most recent timestamp. + Fixes #9033. + + *Brendon Murphy* + +* Throw `NotImplementedError` when trying to instantiate `ActiveRecord::Base` or an abstract class. + + *Aaron Weiner* + +* Warn when `rake db:structure:dump` with a mysl database and + `mysqldump` is not in the PATH or fails. + Fixes #9518. + + *Yves Senn* + +* Remove `connection#structure_dump`, which is no longer used. *Yves Senn* + +* Make it possible to execute migrations without a transaction even + if the database adapter supports DDL transactions. + Fixes #9483. + + Example: + + class ChangeEnum < ActiveRecord::Migration + disable_ddl_transaction! + + def up + execute "ALTER TYPE model_size ADD VALUE 'new_value'" + end + end + + *Yves Senn* + * Assigning "0.0" to a nullable numeric column does not make it dirty. Fix #9034. |