aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/has_many_through_association.rb
Commit message (Collapse)AuthorAgeFilesLines
* Adding a bang to method name of raise_on_type_mismatch.wangjohn2013-03-211-1/+1
|
* Reverting 16f6f25 (Change behaviour with empty array in where clause)Guillermo Iguaran2013-02-081-1/+1
|
* Change behaviour with empty array in where clauserobertomiranda2013-02-081-1/+1
|
* target_reflection_has_associated_record? refactoringAngelo Capilleri2013-01-081-5/+1
|
* Fix for has_many_through counter_cache bugMatthew Robertson2012-12-141-0/+5
| | | | | | This commit fixes reported issue #7630 in which counter caches were not being updated properly when replacing has_many_through relationships
* Merge pull request #7251 from rails/integrate-strong_parametersDavid Heinemeier Hansson2012-09-181-2/+2
|\ | | | | Integrate strong_parameters in Rails 4
| * Remove mass_assignment_options from ActiveRecordGuillermo Iguaran2012-09-161-2/+2
| |
* | Fix collection= on hm:t join models when unsavedErnie Miller2012-09-171-0/+14
|/ | | | | | If assigning to a has_many :through collection against an unsaved object using the collection=[<array_of_items>] syntax, the join models were not properly created, previously.
* load active_support/core_ext/object/blank in active_support/railsXavier Noria2012-08-021-1/+0
|
* s/scoped/scope/Jon Leighton2012-08-011-2/+2
|
* Deprecate Relation#all.Jon Leighton2012-07-271-1/+1
| | | | | | It has been moved to active_record_deprecated_finders. Use #to_a instead.
* no longer need #delete_all_on_destroyJon Leighton2012-05-181-4/+0
|
* Perf: Don't load the association for #delete_all.Jon Leighton2012-05-181-1/+6
| | | | Bug #6289
* Not need to pass join attributes to association buildRafael Mendonça França2012-03-071-1/+3
|
* Fix #3672 again (dependent: delete_all perf)Jon Leighton2011-12-141-0/+4
|
* Memoize through associationJon Leighton2011-11-031-8/+11
|
* Remove all revelant through records.Jon Leighton2011-11-031-9/+9
| | | | | | | | | If a record is removed from a has_many :through, all of the join records relating to that record should also be removed from the through association's target. (Previously the records were removed in the database, but only one was removed from the in-memory target array.)
* Fix adding multiple instances of the same record to a has_many :through.Jon Leighton2011-11-031-21/+43
| | | | Fixes #3425.
* added an alias for new to build to the AR collection proxy, this corrects an ↵Josh Kalderimis2011-06-011-2/+0
| | | | issue where the collection proxies were not consistent
* Only save the record once when calling create! on a collection association. ↵Jon Leighton2011-05-311-2/+9
| | | | Fixes #1360.
* singular and collection relations in AR can now specify mass-assignment ↵Josh Kalderimis2011-05-011-2/+2
| | | | security options (:as and :without_protection) in build, create and create! methods.
* Merge branch 'master' into nested_has_many_throughJon Leighton2011-03-041-62/+97
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-10/+10
| |
| * Associations - where possible, call attributes methods rather than directly ↵Jon Leighton2011-02-211-13/+13
| | | | | | | | accessing the instance variables
| * Split AssociationProxy into an Association class (and subclasses) which ↵Jon Leighton2011-02-181-11/+9
| | | | | | | | manages the association, and a CollectionProxy class which is *only* a proxy. Singular associations no longer have a proxy. See CHANGELOG for more.
| * Allow building and then later saving has_many :through records, such that ↵Jon Leighton2011-02-181-4/+46
| | | | | | | | the join record is automatically saved too. This requires the :inverse_of option to be set on the source association in the join model. See the CHANGELOG for details. [#4329 state:resolved]
| * Get rid of AssociationCollection#save_recordJon Leighton2011-02-141-4/+13
| |
| * just return the record from insert_record, use truthiness for comparisonsAaron Patterson2011-02-071-2/+2
| |
| * Refactor the implementations of AssociatioCollection#delete and #destroy to ↵Jon Leighton2011-02-071-1/+1
| | | | | | | | be more consistent with each other, and to stop passing blocks around, thus making the execution easier to follow.
| * Correctly update counter caches on deletion for has_many :through [#2824 ↵Jon Leighton2011-02-071-5/+24
| | | | | | | | state:resolved]. Also fixed a bunch of other counter cache bugs in the process, as once I fixed this one others started appearing like nobody's business.
| * Support the :dependent option on has_many :through associations. For ↵Jon Leighton2011-02-071-9/+8
| | | | | | | | 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 record.association.destroy(*records) on habtm and hm:t only delete ↵Jon Leighton2011-02-071-10/+11
| | | | | | | | records in the join table. This is to make the destroy method more consistent across the different types of associations. For more details see the CHANGELOG entry.
| * Let's be less blasé about method visibility on association proxiesJon Leighton2011-01-301-7/+10
| |
| * Let AssociationCollection#find use #scoped to do its finding. Note that I am ↵Jon Leighton2011-01-031-5/+0
| | | | | | | | 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.
| * Allow assignment on has_one :through where the owner is a new record [#5137 ↵Jon Leighton2011-01-031-1/+0
| | | | | | | | | | | | | | | | | | | | 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!
| * Rename AssociationReflection#primary_key_name to foreign_key, since the ↵Jon Leighton2010-12-311-1/+1
| | | | | | | | options key which it relates to is :foreign_key
| * I N C E P T I O N: flatten_deeper works around a bug in Ruby 1.8.2.Aaron Patterson2010-12-271-1/+1
| |
| * Refactor we_can_set_the_inverse_on_this? to use a less bizarre name amongst ↵Jon Leighton2010-12-261-1/+1
| | | | | | | | other things
| * Add a HasAssociation module for common code for has_* associationsJon Leighton2010-12-261-2/+1
| |
| * Use conditionals and implicit returns rather than explicit returns and ↵Jon Leighton2010-12-261-3/+7
| | | | | | | | postfix ifs (it's easier to read)
| * Remove has_cached_counter? and cached_counter_attribute_name from ↵Jon Leighton2010-12-261-8/+0
| | | | | | | | HasManyThroughAssociation, as the exact same methods are inherited from HasManyAssociation
| * Use the through association proxy for operations on the through record, so ↵Jon Leighton2010-12-261-2/+2
| | | | | | | | that those operations are automatically scoped and therefore construct_join_attributes does not need to use construct_owner_attributes.
| * If a has_many goes :through a belongs_to, and the foreign key of the ↵Jon Leighton2010-12-231-0/+1
| | | | | | | | belongs_to changes, then the has_many should be considered stale.
| * Delete create, create! and create_record from HasManyThroughAssociation in ↵Jon Leighton2010-12-201-18/+0
| | | | | | | | exchange for more generic versions in AssociationCollection
| * Specify insert_record with NotImplementedError in AssociationCollection, to ↵Jon Leighton2010-12-201-5/+1
| | | | | | | | indicate that subclasses should implement it. Also add save_record to reduce duplication.
| * Respect the default_scope on a join model when reading a through associationJon Leighton2010-12-161-1/+1
| |
| * just copy the joins to the listAaron Patterson2010-12-161-1/+1
| |
* | Merge branch 'master' into nested_has_many_throughJon Leighton2010-12-121-2/+2
|\| | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG 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_through_association.rb
| * Partialy revert f1c13b0dd7b22b5f6289ca1a09f1d7a8c7c8584bJosé Valim2010-11-281-2/+2
| |
* | Merge branch 'master' into nested_has_many_throughJon Leighton2010-11-171-3/+2
|\| | | | | | | | | | | Conflicts: activerecord/lib/active_record/associations/has_many_through_association.rb activerecord/test/cases/associations/has_many_through_associations_test.rb