Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Merge branch 'master' of git://github.com/lifo/docrails | Xavier Noria | 2011-02-05 | 1 | -1/+1 |
|\ | |||||
| * | keep options titles consistent to "Options" | Gabriel Horner | 2011-02-03 | 1 | -1/+1 |
| | | |||||
* | | Fixing ordering of HABTM association deletion [#6191 state:resolved] | Edward Faulkner | 2011-02-04 | 1 | -1/+1 |
|/ | | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com> | ||||
* | Removed support for accessing attributes on a has_and_belongs_to_many join ↵ | Jon Leighton | 2011-01-16 | 1 | -6/+0 |
| | | | | table. This has been documented as deprecated behaviour since April 2006. Please use has_many :through instead. A deprecation warning will be added to the 3-0-stable branch for the 3.0.4 release. | ||||
* | Abstract common code from BelongsToAssociation and HasOneAssociation into ↵ | Jon Leighton | 2011-01-16 | 1 | -0/+1 |
| | | | | SingularAssociation | ||||
* | Document the new create_association! method on one-to-one associations | Jon Leighton | 2011-01-16 | 1 | -1/+9 |
| | |||||
* | Add create_association! for belongs_to | Jon Leighton | 2011-01-16 | 1 | -3/+3 |
| | |||||
* | Support for create_association! for has_one associations | Jon Leighton | 2011-01-11 | 1 | -0/+1 |
| | |||||
* | Refactor the code for singular association constructors. This will allow me ↵ | Jon Leighton | 2011-01-11 | 1 | -8/+13 |
| | | | | to define a create_association! method in a minute. | ||||
* | It's not necessary to pass the association proxy class around now | Jon Leighton | 2011-01-11 | 1 | -22/+15 |
| | |||||
* | Get rid of set_association_target and association_loaded? as the parts of ↵ | Jon Leighton | 2011-01-11 | 1 | -12/+0 |
| | | | | the code that need that can now just use association_proxy(:name).loaded?/target= | ||||
* | DRY up the code which instantiates the association proxy | Jon Leighton | 2011-01-11 | 1 | -35/+24 |
| | |||||
* | Document the recent changes to association assignment | Jon Leighton | 2011-01-11 | 1 | -4/+9 |
| | |||||
* | Return value is irrelevant here as the RHS of the assignment is always ↵ | Jon Leighton | 2011-01-11 | 1 | -1/+0 |
| | | | | returned by methods ending in '=' | ||||
* | Remove incorrect documentation about build_assoc on has_one. This is proven, ↵ | Jon Leighton | 2011-01-11 | 1 | -2/+1 |
| | | | | for example, by test_successful_build_association in has_one_associations_test.rb | ||||
* | For a singular association, it should be build_association, rather than ↵ | Jon Leighton | 2011-01-11 | 1 | -1/+1 |
| | | | | association.build (as association may be nil) | ||||
* | Correctly indent the bullet points under 'One-to-one associations', so that ↵ | Jon Leighton | 2011-01-11 | 1 | -10/+10 |
| | | | | the lines are not broken in the generated rdoc html | ||||
* | Not really worth having the HasAssociation module for just a single method | Jon Leighton | 2011-01-07 | 1 | -1/+0 |
| | |||||
* | just use a hash for doing association caching | Aaron Patterson | 2011-01-07 | 1 | -7/+7 |
| | |||||
* | no need for self | Aaron Patterson | 2011-01-06 | 1 | -1/+1 |
| | |||||
* | Remove undocumented feature from has_one where you could pass false as the ↵ | Jon Leighton | 2011-01-03 | 1 | -8/+3 |
| | | | | | | | | | | | | second parameter to build_assoc or create_assoc, and the existing associated object would be untouched (the foreign key would not be nullified, and it would not be deleted). If you want behaviour similar to this you can do the following things: * Use :dependent => :nullify (or don't specify :dependent) if you want to prevent the existing associated object from being deleted * Use has_many if you actually want multiple associated objects * Explicitly set the foreign key if, for some reason, you really need to have multiple objects associated with the same has_one. E.g. previous = obj.assoc obj.create_assoc previous.update_attributes(:obj_id => obj.id) | ||||
* | When preloading a belongs_to, the target should still be set (to nil) if ↵ | Jon Leighton | 2011-01-03 | 1 | -0/+1 |
| | | | | there is no foreign key present. And the loaded flag should be set on the association proxy. This then allows us to remove the foreign_key_present? check from BelongsToAssociation#find_target. Also added a test for the same thing on polymorphic associations. | ||||
* | Allow assignment on has_one :through where the owner is a new record [#5137 ↵ | Jon Leighton | 2011-01-03 | 1 | -11/+12 |
| | | | | | | | | | | 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 Leighton | 2011-01-03 | 1 | -7/+1 |
| | | | | options[:foreign_type] | ||||
* | Add documentation for the :foreign_type option on belongs_to | Jon Leighton | 2011-01-03 | 1 | -0/+5 |
| | |||||
* | Rename AssociationReflection#primary_key_name to foreign_key, since the ↵ | Jon Leighton | 2010-12-31 | 1 | -2/+2 |
| | | | | options key which it relates to is :foreign_key | ||||
* | Get rid of extra_conditions param from configure_dependency_for_has_many. I ↵ | Jon Leighton | 2010-12-31 | 1 | -9/+3 |
| | | | | can't see a particularly plausible argument for this being used by plugins, and if they really want they can just redefine the callback or whatever. Note also that before my recent commit the extra_conditions param was completely ignored for :dependent => :destroy. | ||||
* | Refactor configure_dependency_for_has_many to use ↵ | Jon Leighton | 2010-12-31 | 1 | -38/+20 |
| | | | | AssociationCollection#delete_all. It was necessary to change test_before_destroy in lifecycle_test.rb so that it checks topic.replies.size *before* doing the destroy, as afterwards it will now (correctly) be 0. | ||||
* | Add a HasAssociation module for common code for has_* associations | Jon Leighton | 2010-12-26 | 1 | -0/+2 |
| | |||||
* | Raise an error for associations which try to go :through a polymorphic ↵ | Jon Leighton | 2010-12-23 | 1 | -1/+7 |
| | | | | association [#6212 state:resolved] | ||||
* | If a has_many goes :through a belongs_to, and the foreign key of the ↵ | Jon Leighton | 2010-12-23 | 1 | -1/+5 |
| | | | | belongs_to changes, then the has_many should be considered stale. | ||||
* | Improved strategy for updating a belongs_to association when the foreign key ↵ | Jon Leighton | 2010-12-23 | 1 | -42/+1 |
| | | | | changes. Rather than resetting each affected association when the foreign key changes, we should lazily check for 'staleness' (where fk does not match target id) when the association is accessed. | ||||
* | Revert "Optimize <association>_ids for hm:t with belongs_to source". The ↵ | Jon Leighton | 2010-12-23 | 1 | -8/+1 |
| | | | | | | | | | | optimisation has too many edge cases, such as when the reflection, source reflection, or through reflection has conditions, orders, etc. [#6153 state:resolved] This reverts commit 373b053dc8b99dac1abc3879a17a2bf8c30302b5. Conflicts: activerecord/lib/active_record/associations.rb | ||||
* | Don't allow a has_one association to go :through a collection association ↵ | Jon Leighton | 2010-12-23 | 1 | -0/+6 |
| | | | | [#2976 state:resolved] | ||||
* | removing method to prevent warnings | Aaron Patterson | 2010-12-08 | 1 | -0/+4 |
| | |||||
* | Setting the id of a belongs_to object updates all referenced objects [#2989 ↵ | Jeff Dean | 2010-12-08 | 1 | -0/+37 |
| | | | | state:resolved] | ||||
* | breaking classes up in to respective files | Aaron Patterson | 2010-11-23 | 1 | -574/+1 |
| | |||||
* | class inheritable attributes is used no more! all internal use of class ↵ | Josh Kalderimis | 2010-11-20 | 1 | -6/+7 |
| | | | | | | inheritable has been changed to class_attribute. class inheritable attributes has been deprecated. Signed-off-by: José Valim <jose.valim@gmail.com> | ||||
* | use persisted? instead of new_record? wherever possible | David Chelimsky | 2010-11-09 | 1 | -1/+1 |
| | | | | | | | | | | | - persisted? is the API defined in ActiveModel - makes it easier for extension libraries to conform to ActiveModel APIs without concern for whether the extended object is specifically ActiveRecord [#5927 state:committed] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com> | ||||
* | reduce duplication in assiciations #construct() | Aaron Patterson | 2010-11-06 | 1 | -9/+3 |
| | |||||
* | make sure we keep parent records in order | Aaron Patterson | 2010-11-06 | 1 | -6/+6 |
| | |||||
* | only call to_s on the association variable once | Aaron Patterson | 2010-11-05 | 1 | -2/+5 |
| | |||||
* | simplify instantiate in the join parts object | Aaron Patterson | 2010-11-05 | 1 | -8/+7 |
| | |||||
* | index is not used, so removing it | Aaron Patterson | 2010-11-05 | 1 | -1/+1 |
| | |||||
* | reduce method calls to the join base object | Aaron Patterson | 2010-11-05 | 1 | -4/+6 |
| | |||||
* | refactoring find_join_association | Aaron Patterson | 2010-10-30 | 1 | -5/+6 |
| | |||||
* | Fix issues when including the same association multiple times and mixing ↵ | Ernie Miller | 2010-10-30 | 1 | -11/+37 |
| | | | | joins/includes together. | ||||
* | removing space errors | Aaron Patterson | 2010-10-22 | 1 | -45/+45 |
| | |||||
* | Delete unused methods in JoinAssociation | Jon Leighton | 2010-10-13 | 1 | -8/+0 |
| | |||||
* | Renaming and formatting changes in JoinDependency | Jon Leighton | 2010-10-13 | 1 | -47/+51 |
| |