diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-08-01 23:14:29 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-08-01 23:19:52 +0100 |
commit | 0e1cafcbc4d67854faf35e489571bc30f5e2ac14 (patch) | |
tree | 0722f7017ef190289c92361ab9d086793a4f95de /activerecord/CHANGELOG.md | |
parent | 26d3e325cb85884504564b8af07dd083fc47d2a8 (diff) | |
download | rails-0e1cafcbc4d67854faf35e489571bc30f5e2ac14.tar.gz rails-0e1cafcbc4d67854faf35e489571bc30f5e2ac14.tar.bz2 rails-0e1cafcbc4d67854faf35e489571bc30f5e2ac14.zip |
Add CollectionProxy#scope
This can be used to get a Relation from an association.
Previously we had a #scoped method, but we're deprecating that for
AR::Base, so it doesn't make sense to have it here.
This was requested by DHH, to facilitate code like this:
Project.scope.order('created_at DESC').page(current_page).tagged_with(@tag).limit(5).scoping do
@topics = @project.topics.scope
@todolists = @project.todolists.scope
@attachments = @project.attachments.scope
@documents = @project.documents.scope
end
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r-- | activerecord/CHANGELOG.md | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 3d23e88256..c78e602af7 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,5 +1,23 @@ ## Rails 4.0.0 (unreleased) ## +* Add CollectionProxy#scope + + This can be used to get a Relation from an association. + + Previously we had a #scoped method, but we're deprecating that for + AR::Base, so it doesn't make sense to have it here. + + This was requested by DHH, to facilitate code like this: + + Project.scope.order('created_at DESC').page(current_page).tagged_with(@tag).limit(5).scoping do + @topics = @project.topics.scope + @todolists = @project.todolists.scope + @attachments = @project.attachments.scope + @documents = @project.documents.scope + end + + *Jon Leighton* + * Add `Relation#load` This method explicitly loads the records and then returns `self`. |