Files
rails/activerecord/lib/active_record
Murray Steele ccea98389a Providing support for :inverse_of as an option to associations.
You can now add an :inverse_of option to has_one, has_many and belongs_to associations.  This is best described with an example:

class Man < ActiveRecord::Base
  has_one :face, :inverse_of => :man
end

class Face < ActiveRecord::Base
  belongs_to :man, :inverse_of => :face
end

m = Man.first
f = m.face

Without :inverse_of m and f.man would be different instances of the same object (f.man being pulled from the database again).  With these new :inverse_of options m and f.man are the same in memory instance.

Currently :inverse_of supports has_one and has_many (but not the :through variants) associations.  It also supplies inverse support for belongs_to associations where the inverse is a has_one and it's not a polymorphic.

Signed-off-by: Murray Steele <muz@h-lame.com>
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-05-04 15:27:39 -07:00
..
2009-01-18 18:10:58 +00:00
2008-10-05 22:16:26 +01:00
2009-04-22 16:42:14 -07:00
2009-03-16 11:28:36 +00:00
2009-02-24 12:29:25 +00:00
2009-02-24 12:29:25 +00:00
2008-12-07 03:27:53 +01:00
2008-05-25 12:29:00 +01:00
2009-04-26 20:24:45 -07:00
2009-04-05 12:36:36 +01:00
2009-03-15 22:06:50 -05:00