From bf03ddc6365c8ea83647b5f315a34aa5c6b65df1 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 21 Dec 2009 13:18:11 -0800 Subject: Missed changelog entry for :inverse_of --- activerecord/CHANGELOG | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activerecord/CHANGELOG') diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 1f7a95a53a..be4d197f99 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,12 @@ *Edge* +* Association inverses for belongs_to, has_one, and has_many. Optimization to reduce database queries. #3533 [Murray Steele] + + # post.comments sets each comment's post without needing to :include + class Post < ActiveRecord::Base + has_many :comments, :inverse_of => :post + end + * MySQL: add_ and change_column support positioning. #3286 [Ben Marini] * Reset your Active Record counter caches with the reset_counter_cache class method. #1211 [Mike Breen, Gabe da Silveira] -- cgit v1.2.3 From 5f5aa44d2de9e7d93087d52862502c12722bdae3 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Sat, 26 Dec 2009 12:43:49 +0530 Subject: Add missing changelog entries --- activerecord/CHANGELOG | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'activerecord/CHANGELOG') diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index be4d197f99..d13a9e61df 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,30 @@ *Edge* +* Rename Model.conditions and relation.conditions to .where. [Pratik Naik] + + Before : + User.conditions(:name => 'lifo') + User.select('id').conditions(["age > ?", 21]) + + Now : + User.where(:name => 'lifo') + User.select('id').where(["age > ?", 21]) + +* Add Model.select/group/order/limit/joins/conditions/preload/eager_load class methods returning a lazy relation. [Pratik Naik] + + Examples : + + posts = Post.select('id).order('name') # Returns a lazy relation + posts.each {|p| puts p.id } # Fires "select id from posts order by name" + +* Model.scoped now returns a relation if invoked without any arguments. [Pratik Naik] + + Example : + + posts = Post.scoped + posts.size # Fires "select count(*) from posts" and returns the count + posts.each {|p| puts p.name } # Fires "select * from posts" and loads post objects + * Association inverses for belongs_to, has_one, and has_many. Optimization to reduce database queries. #3533 [Murray Steele] # post.comments sets each comment's post without needing to :include -- cgit v1.2.3 From 9a9f97af2815469e6f28dee9b88577251ef1b832 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Sat, 26 Dec 2009 15:28:23 +0530 Subject: Add relation.reload to force reloading the records --- activerecord/CHANGELOG | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activerecord/CHANGELOG') diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index d13a9e61df..e584979251 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,13 @@ *Edge* +* Add relation.reload to force reloading the records. [Pratik Naik] + + topics = Topic.scoped + topics.to_a # force load + topics.first # returns a cached record + topics.reload + topics.first # Fetches a new record from the database + * Rename Model.conditions and relation.conditions to .where. [Pratik Naik] Before : -- cgit v1.2.3 From 83f24afd44ecd6fb6e38d5e8a6830dfca4bf5ffe Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Sun, 27 Dec 2009 00:21:24 +0530 Subject: Add new finder methods to association collection. --- activerecord/CHANGELOG | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'activerecord/CHANGELOG') diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index e584979251..df221a1ad0 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,15 @@ *Edge* +* Add new finder methods to association collection. [Pratik Naik] + + class User < ActiveRecord::Base + has_many :items + end + + user = User.first + user.items.where(:items => {:colour => 'red'}) + user.items.select('items.id') + * Add relation.reload to force reloading the records. [Pratik Naik] topics = Topic.scoped -- cgit v1.2.3 From d92c4a84023bc0c8dd75869c9b4d5e50277f4650 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Sun, 27 Dec 2009 16:14:04 +0530 Subject: Add find(ids) to relations --- activerecord/CHANGELOG | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activerecord/CHANGELOG') diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index df221a1ad0..a2c5528860 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,11 @@ *Edge* +* Add find(ids) to relations. [Pratik Naik] + + old_users = User.order("age DESC") + old_users.find(1) + old_users.find(1, 2, 3) + * Add new finder methods to association collection. [Pratik Naik] class User < ActiveRecord::Base -- cgit v1.2.3