diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2013-11-02 15:40:39 -0700 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2013-11-02 15:40:39 -0700 |
commit | 6d30219c2734f2678d74a54b791a311748b3e64f (patch) | |
tree | b9da7bebd2e3c375afab44791fd4205254f13b50 /activerecord/CHANGELOG.md | |
parent | 423249504a2b468d7a273cbe6accf4f21cb0e643 (diff) | |
parent | a2f27385f60292c77e5e29a9568f1888a7c3d214 (diff) | |
download | rails-6d30219c2734f2678d74a54b791a311748b3e64f.tar.gz rails-6d30219c2734f2678d74a54b791a311748b3e64f.tar.bz2 rails-6d30219c2734f2678d74a54b791a311748b3e64f.zip |
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r-- | activerecord/CHANGELOG.md | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 5716cc4b5d..16376b0b89 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,27 +1,27 @@ -* 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: %i( 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* +* 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) @@ -35,6 +35,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 @@ -50,7 +51,6 @@ vendor.users.to_a # => No exception is raised - Fixes #12242, #9517, #10240. *Paul Nikitochkin* |