aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/through_association.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* Add a test for STI on the through where the through is nested, and change ↵Jon Leighton2011-03-051-13/+22
| | | | the code which support this
* Merge branch 'master' into nested_has_many_throughJon Leighton2011-03-041-49/+172
| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/class_methods/join_dependency.rb activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb activerecord/lib/active_record/associations/has_many_association.rb activerecord/lib/active_record/associations/has_many_through_association.rb activerecord/lib/active_record/associations/has_one_association.rb activerecord/lib/active_record/associations/has_one_through_association.rb activerecord/lib/active_record/associations/through_association_scope.rb activerecord/lib/active_record/reflection.rb activerecord/test/cases/associations/has_many_through_associations_test.rb activerecord/test/cases/associations/has_one_through_associations_test.rb activerecord/test/cases/reflection_test.rb activerecord/test/cases/relations_test.rb activerecord/test/fixtures/memberships.yml activerecord/test/models/categorization.rb activerecord/test/models/category.rb activerecord/test/models/member.rb activerecord/test/models/reference.rb activerecord/test/models/tagging.rb
* Delegate through_reflection and source_reflection to reflectionJon Leighton2011-02-211-23/+23
|
* Delegate Association#options to the reflection, and replace ↵Jon Leighton2011-02-211-9/+11
| | | | 'reflection.options' with 'options'. Also add through_options and source_options methods for through associations.
* Associations - where possible, call attributes methods rather than directly ↵Jon Leighton2011-02-211-34/+34
| | | | accessing the instance variables
* Add :nodoc: to ThroughAssociation and HasOneAssociationJon Leighton2011-02-181-1/+1
|
* Add interpolation of association conditions back in, in the form of proc { ↵Jon Leighton2011-02-141-2/+2
| | | | ... } rather than instance_eval-ing strings
* Remove Relation#& alias for Relation#mergeErnie Miller2011-02-121-1/+1
|
* Support the :dependent option on has_many :through associations. For ↵Jon Leighton2011-02-071-7/+26
| | | | historical and practical reasons, :delete_all is the default deletion strategy employed by association.delete(*records), despite the fact that the default strategy is :nullify for regular has_many. Also, this only works at all if the source reflection is a belongs_to. For other situations, you should directly modify the through association.
* Make use of helpers in AssociationReflectionJon Leighton2011-01-301-4/+4
|
* Has many through - It is not necessary to manually merge in the conditions ↵Jon Leighton2011-01-301-4/+0
| | | | hash for the through record, because the creation is done directly on the through association, which will already handle setting the conditions.
* Don't pass around conditions as strings in ThroughAssociationJon Leighton2011-01-301-30/+25
|
* Indent methods under private/protected sectionsJon Leighton2011-01-301-101/+101
|
* Let's be less blasé about method visibility on association proxiesJon Leighton2011-01-301-7/+9
|
* Construct an actual ActiveRecord::Relation object for the association scope, ↵Jon Leighton2011-01-071-13/+8
| | | | rather than a hash which is passed to apply_finder_options. This allows more flexibility in how the scope is created, for example because scope.where(a, b) and scope.where(a).where(b) mean different things.
* Create the association scope directly rather than going through with_scopeJon Leighton2011-01-031-9/+6
|
* Let AssociationCollection#find use #scoped to do its finding. Note that I am ↵Jon Leighton2011-01-031-14/+5
| | | | removing test_polymorphic_has_many_going_through_join_model_with_disabled_include, since this specifies different behaviour for an association than for a regular scope. It seems reasonable to expect scopes and association proxies to behave in roughly the same way rather than having subtle differences.
* Rename AssociationProxy#foreign_key_present to foreign_key_present?Jon Leighton2011-01-031-1/+1
|
* Allow assignment on has_one :through where the owner is a new record [#5137 ↵Jon Leighton2011-01-031-13/+7
| | | | | | | | | | state:resolved] This required changing the code to keep the association proxy for a belongs_to around, despite its target being nil. Which in turn required various changes to the way that stale target checking is handled, in order to support various edge cases (loaded target is nil then foreign key added, foreign key is changed and then changed back, etc). A side effect is that the code is nicer and more succinct. Note that I am removing test_no_unexpected_aliasing since that is basically checking that the proxy for a belongs_to *does* change, which is the exact opposite of the intention of this commit. Also adding various tests for various edge cases and related things. Phew, long commit message!
* Have a proper AssociationReflection#foreign_type method rather than using ↵Jon Leighton2011-01-031-2/+2
| | | | options[:foreign_type]
* Rename AssociationReflection#primary_key_name to foreign_key, since the ↵Jon Leighton2010-12-311-5/+5
| | | | options key which it relates to is :foreign_key
* Refactor BelongsToAssociation to allow BelongsToPolymorphicAssociation to ↵Jon Leighton2010-12-311-2/+0
| | | | inherit from it
* Add a HasAssociation module for common code for has_* associationsJon Leighton2010-12-261-0/+169