1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Ruby on Rails
Find a file
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
actionmailer Fixes ActionMailer to work with the ActionView refactoring 2009-04-27 12:34:25 -07:00
actionpack Wrap dispatcher callbacks around the whole middleware chain. Kill unnecessary Reloader middleware. 2009-05-03 09:41:40 -05:00
activemodel Fix tests on 1.9 2009-04-22 17:07:04 -07:00
activerecord Providing support for :inverse_of as an option to associations. 2009-05-04 15:27:39 -07:00
activeresource Fix differing rails_to_json arity 2009-04-26 20:26:44 -07:00
activesupport Fixed Hash#from_xml with keys that are all caps. 2009-05-04 10:01:01 -07:00
ci Updated for Rack 1.0 2009-04-25 12:33:14 -07:00
doc/template Horo rdoc template 2008-06-22 10:38:25 -07:00
railties Additional tests for the gem subsystem 2009-04-29 08:07:57 -07:00
.gitignore Bring abstract_controller up to date with rails/master 2009-04-13 15:18:45 -07:00
pushgems.rb No more svn version numbers to rely on, use timestamps instead 2008-05-11 18:21:47 -05:00
Rakefile Get Active Model in the mix 2009-04-22 01:02:54 -07:00
release.rb Use copy instead of export for release 2008-09-05 14:22:56 +02:00