aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorRafael Mendonça França <rafael.franca@plataformatec.com.br>2012-08-20 15:51:35 -0300
committerRafael Mendonça França <rafael.franca@plataformatec.com.br>2012-08-20 15:51:35 -0300
commit81d596aa7f7db69b27fda1c7e732a204b81d4b15 (patch)
tree8e0fda9c9a63f927047b6a63bdec582693d84037 /guides
parent8cb9460437eddde6952fbebbc969203cd4d00294 (diff)
downloadrails-81d596aa7f7db69b27fda1c7e732a204b81d4b15.tar.gz
rails-81d596aa7f7db69b27fda1c7e732a204b81d4b15.tar.bz2
rails-81d596aa7f7db69b27fda1c7e732a204b81d4b15.zip
Revert "association_basics, updated how inverse_of works"
This reverts commit 8cb9460437eddde6952fbebbc969203cd4d00294. Reason: #7377 was merged and it fixes this behavior.
Diffstat (limited to 'guides')
-rw-r--r--guides/source/association_basics.textile5
1 files changed, 2 insertions, 3 deletions
diff --git a/guides/source/association_basics.textile b/guides/source/association_basics.textile
index f6b1a0ef7a..d4c0a1ba74 100644
--- a/guides/source/association_basics.textile
+++ b/guides/source/association_basics.textile
@@ -520,7 +520,7 @@ By default, Active Record doesn't know about the connection between these associ
<ruby>
c = Customer.first
-o = c.orders[0]
+o = c.orders.first
c.first_name == o.customer.first_name # => true
c.first_name = 'Manny'
c.first_name == o.customer.first_name # => false
@@ -542,7 +542,7 @@ With these changes, Active Record will only load one copy of the customer object
<ruby>
c = Customer.first
-o = c.orders[0]
+o = c.orders.first
c.first_name == o.customer.first_name # => true
c.first_name = 'Manny'
c.first_name == o.customer.first_name # => true
@@ -550,7 +550,6 @@ c.first_name == o.customer.first_name # => true
There are a few limitations to +inverse_of+ support:
-* They do not work with methods that invoke new query. E.g. using c.orders.first instead of c.orders[0] in the code above
* They do not work with <tt>:through</tt> associations.
* They do not work with <tt>:polymorphic</tt> associations.
* They do not work with <tt>:as</tt> associations.