1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/models
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
..
author.rb Ensure :dependent => :delete_all works for association with hash conditions 2009-04-20 18:12:40 +01:00
auto_id.rb move assets and models 2008-01-18 07:27:03 +00:00
binary.rb move assets and models 2008-01-18 07:27:03 +00:00
bird.rb Add support for nested object forms to ActiveRecord and the helpers in ActionPack 2009-02-01 14:44:30 +13:00
book.rb move assets and models 2008-01-18 07:27:03 +00:00
categorization.rb move assets and models 2008-01-18 07:27:03 +00:00
category.rb Add :having option to find, to use in combination with grouped finds. Also added to has_many and has_and_belongs_to_many associations. 2008-12-01 20:22:31 +01:00
citation.rb move assets and models 2008-01-18 07:27:03 +00:00
club.rb Ensure methods called on association proxies respect access control. [#1083 state:resolved] [Adam Milligan, Pratik] 2008-10-13 19:02:34 +02:00
column_name.rb move assets and models 2008-01-18 07:27:03 +00:00
comment.rb Merge the has_finder gem, renamed as 'named_scope'. Closes #11404 [nkallen] 2008-03-24 02:50:02 +00:00
company.rb Ensure :dependent => :delete_all works for association with hash conditions 2009-04-20 18:12:40 +01:00
company_in_module.rb Improve ActiveRecord::Base#table_name unit tests for nested classes. Closes #10289. [scott_willson] 2008-04-07 19:44:37 +00:00
computer.rb move assets and models 2008-01-18 07:27:03 +00:00
contact.rb move assets and models 2008-01-18 07:27:03 +00:00
course.rb move assets and models 2008-01-18 07:27:03 +00:00
customer.rb Added :constructor and :converter options to composed_of and deprecated the conversion block 2008-09-10 18:28:47 +02:00
default.rb move assets and models 2008-01-18 07:27:03 +00:00
developer.rb Fix default_scope to work in combination with named scopes 2008-11-17 22:00:14 +01:00
edge.rb move assets and models 2008-01-18 07:27:03 +00:00
entrant.rb move assets and models 2008-01-18 07:27:03 +00:00
event.rb Ensure validates_uniqueness_of considers limit on the field. [#1042 state:resolved] 2009-03-07 13:52:17 +00:00
face.rb Providing support for :inverse_of as an option to associations. 2009-05-04 15:27:39 -07:00
guid.rb Fix validates_uniqueness_of for SQL keywords [#23 state:resolved] 2008-05-11 19:30:03 +01:00
interest.rb Providing support for :inverse_of as an option to associations. 2009-05-04 15:27:39 -07:00
item.rb move assets and models 2008-01-18 07:27:03 +00:00
job.rb Ensure table names are quoted by the association preloading code. 2008-04-26 12:14:50 +12:00
joke.rb move assets and models 2008-01-18 07:27:03 +00:00
keyboard.rb move assets and models 2008-01-18 07:27:03 +00:00
legacy_thing.rb move assets and models 2008-01-18 07:27:03 +00:00
man.rb Providing support for :inverse_of as an option to associations. 2009-05-04 15:27:39 -07:00
matey.rb move assets and models 2008-01-18 07:27:03 +00:00
member.rb Fix preloading of has_one :through associations on belongs_to [#1507 state:resolved] 2008-12-18 19:19:36 +00:00
member_detail.rb Fix preloading of has_one :through associations on belongs_to [#1507 state:resolved] 2008-12-18 19:19:36 +00:00
member_type.rb Fix preloading of has_one :through associations on belongs_to [#1507 state:resolved] 2008-12-18 19:19:36 +00:00
membership.rb Add has_one :through support, finally. Closes #4756 [thechrisoshow] 2008-03-21 18:09:03 +00:00
minimalistic.rb move assets and models 2008-01-18 07:27:03 +00:00
mixed_case_monkey.rb move assets and models 2008-01-18 07:27:03 +00:00
movie.rb move assets and models 2008-01-18 07:27:03 +00:00
order.rb move assets and models 2008-01-18 07:27:03 +00:00
organization.rb Fixed bug with polymorphic has_one :as pointing to an STI record 2009-05-01 14:47:56 -07:00
owner.rb Ensure has_many :through works with changed primary keys [#736 state:resolved] 2009-03-09 13:43:28 +00:00
parrot.rb Add support for nested object forms to ActiveRecord and the helpers in ActionPack 2009-02-01 14:44:30 +13:00
person.rb Preload uses exclusive scope [#643 state:resolved] 2008-12-26 18:25:55 +00:00
pet.rb Added :touch option to belongs_to associations that will touch the parent record when the current record is saved or destroyed [DHH] 2009-04-16 17:25:55 -05:00
pirate.rb Ensure AutosaveAssociation runs remove callbacks [#2146 state:resolved] 2009-03-12 15:24:37 +00:00
post.rb Fixed bug that makes named_scopes _forgot_ current scope 2009-02-25 09:21:08 -08:00
price_estimate.rb Fix has_many :through a polymorphic has_many. Closes #10529 [Aleksey Kondratenko] 2008-02-02 03:27:31 +00:00
project.rb Fix tests for sqlite3 3.6.xx 2009-04-21 13:06:26 +01:00
reader.rb move assets and models 2008-01-18 07:27:03 +00:00
reference.rb Ensure table names are quoted by the association preloading code. 2008-04-26 12:14:50 +12:00
reply.rb Ensure belongs_to association with a counter cache in name spaced model works [#1678 state:resolved] 2009-03-06 22:05:18 +00:00
ship.rb Changed API of NestedAttributes to take an array, or hash with index keys, of hashes that have the id on the inside of the attributes hash and updated the FormBuilder to produce such hashes. Also fixed NestedAttributes with composite ids. 2009-02-13 21:47:56 +13:00
ship_part.rb Add support for nested object forms to ActiveRecord and the helpers in ActionPack 2009-02-01 14:44:30 +13:00
sponsor.rb Add has_one :through support, finally. Closes #4756 [thechrisoshow] 2008-03-21 18:09:03 +00:00
subject.rb move assets and models 2008-01-18 07:27:03 +00:00
subscriber.rb Fixed AssociationsPreload such that it doesnt require foreign keys to be integers (fcheung) [#33 state:resolved] 2008-04-30 23:30:50 -05:00
subscription.rb Added missing files 2008-05-01 15:03:16 -05:00
tag.rb move assets and models 2008-01-18 07:27:03 +00:00
tagging.rb move assets and models 2008-01-18 07:27:03 +00:00
task.rb move assets and models 2008-01-18 07:27:03 +00:00
topic.rb Returning nil from named scope lambda is equivalent to an empty hash [#1773 state:resolved] 2009-03-12 15:06:19 +00:00
toy.rb Ensure has_many :through works with changed primary keys [#736 state:resolved] 2009-03-09 13:43:28 +00:00
treasure.rb Fix has_many :through a polymorphic has_many. Closes #10529 [Aleksey Kondratenko] 2008-02-02 03:27:31 +00:00
vertex.rb move assets and models 2008-01-18 07:27:03 +00:00
warehouse_thing.rb move assets and models 2008-01-18 07:27:03 +00:00
zine.rb Providing support for :inverse_of as an option to associations. 2009-05-04 15:27:39 -07:00