Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "association_basics, updated how inverse_of works"

This reverts commit 8cb9460.

Reason: #7377 was merged and it fixes this behavior.
  • Loading branch information...
commit 81d596aa7f7db69b27fda1c7e732a204b81d4b15 1 parent 8cb9460
@rafaelfranca rafaelfranca authored
Showing with 2 additions and 3 deletions.
  1. +2 −3 guides/source/association_basics.textile
View
5 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.
Please sign in to comment.
Something went wrong with that request. Please try again.