aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
Commit message (Collapse)AuthorAgeFilesLines
...
* common @jonleighton :bomb:Aaron Patterson2011-04-121-2/+1
|
* Deprecate defining scopes with a callable (lambda, proc, etc) via the scope ↵Jon Leighton2011-04-123-21/+32
| | | | class method. Just define a class method yourself instead.
* Evaluate default scopes at the last possible moment in order to avoid ↵Jon Leighton2011-04-121-0/+2
| | | | problems with default scopes getting included into other scopes and then being unable to remove the default part via unscoped.
* Deprecated support for passing hashes and relations to default_scope, in ↵Jon Leighton2011-04-128-23/+102
| | | | favour of defining a 'default_scope' class method in the model. See the CHANGELOG for more details.
* oracle, y u defy meJon Leighton2011-03-163-7/+9
|
* Add a test for STI on the through where the through is nested, and change ↵Jon Leighton2011-03-052-0/+2
| | | | the code which support this
* Merge branch 'master' into nested_has_many_throughJon Leighton2011-03-0426-35/+225
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Rewrote AssociationPreload.Jon Leighton2011-02-281-1/+2
| |
| * Allow building and then later saving has_many :through records, such that ↵Jon Leighton2011-02-183-1/+5
| | | | | | | | 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]
| * Ensure that association_ids uses the correct attribute where the association ↵Jon Leighton2011-02-181-0/+1
| | | | | | | | is a has_many :through with a :primary_key option on the source reflection. [#6376 state:resolved]
| * Add interpolation of association conditions back in, in the form of proc { ↵Jon Leighton2011-02-144-17/+23
| | | | | | | | ... } rather than instance_eval-ing strings
| * make set_table_name take effect immediatelyJan2011-02-081-0/+4
| |
| * Correctly update counter caches on deletion for has_many :through [#2824 ↵Jon Leighton2011-02-071-0/+5
| | | | | | | | 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-072-1/+38
| | | | | | | | 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.
| * Fixing ordering of HABTM association deletion [#6191 state:resolved]Edward Faulkner2011-02-042-0/+14
| | | | | | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
| * introduce a fake AR adapter for mocking database return valuesAaron Patterson2011-02-041-5/+7
| |
| * share column cache among subclasses, only look up columns per AR::Base ↵Aaron Patterson2011-02-011-0/+4
| | | | | | | | subclass once
| * Propagate association extensions to scopes called on the association.Glenn Vanderburg2011-02-011-0/+1
| | | | | | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
| * Has many through - It is not necessary to manually merge in the conditions ↵Jon Leighton2011-01-302-1/+5
| | | | | | | | hash for the through record, because the creation is done directly on the through association, which will already handle setting the conditions.
| * We shouldn't be using scoped.scoping { ... } to build associated records, as ↵Jon Leighton2011-01-302-2/+11
| | | | | | | | this can affect validations/callbacks/etc inside the record itself [#6252 state:resolved]
| * belongs_to records should be initialized within the association scopeJon Leighton2011-01-161-0/+1
| |
| * Add create_association! for belongs_toJon Leighton2011-01-161-0/+1
| |
| * DRY up the code which instantiates the association proxyJon Leighton2011-01-112-0/+11
| |
| * has_one should always remove the old record (properly), even if not saving ↵Jon Leighton2011-01-111-0/+4
| | | | | | | | the new record, so we don't get the database into a pickle
| * Fix polymorphic belongs_to associationproxy raising errors when loading target.Ernie Miller2011-01-111-0/+2
| |
| * Construct an actual ActiveRecord::Relation object for the association scope, ↵Jon Leighton2011-01-071-1/+0
| | | | | | | | 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.
| * send() will raise an ArgumentError, so we should leverage rubyAaron Patterson2011-01-071-1/+1
| |
| * Let AssociationCollection#find use #scoped to do its finding. Note that I am ↵Jon Leighton2011-01-033-1/+10
| | | | | | | | 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-0/+1
| | | | | | | | | | | | | | | | | | | | 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!
| * Some basic tests for the :foreign_type option on belongs_to, which was ↵Jon Leighton2011-01-031-1/+2
| | | | | | | | previously completely untested.
| * Verify that when has_many associated objects are destroyed via :dependent => ↵Jon Leighton2010-12-311-1/+16
| | | | | | | | :destroy, when the parent is destroyed, the callbacks are run
| * Make sure Model#touch doesn't try to update non existing columnsPratik Naik2010-12-301-1/+3
| |
| * Make serialized fixtures work againPratik Naik2010-12-291-0/+3
| |
| * Raise an error for associations which try to go :through a polymorphic ↵Jon Leighton2010-12-231-1/+2
| | | | | | | | association [#6212 state:resolved]
| * Test to verify that #2189 (count with has_many :through and a named_scope) ↵Jon Leighton2010-12-231-0/+2
| | | | | | | | is fixed
| * Fix creation of has_many through records with custom primary_key option on ↵Szymon Nowak2010-12-232-0/+2
| | | | | | | | belongs_to [#2990 state:resolved]
| * Verify that has_one :through preload respects the :conditions [#2976 ↵Will Bryant2010-12-231-0/+1
| | | | | | | | state:resolved]
| * Don't allow a has_one association to go :through a collection association ↵Jon Leighton2010-12-232-4/+9
| | | | | | | | [#2976 state:resolved]
| * removing SQL interpolation, please use scoping and attribute conditionals as ↵Aaron Patterson2010-12-221-3/+0
| | | | | | | | a replacement
| * has_many associations with :dependent => :delete_all should update the ↵Jon Leighton2010-12-201-0/+2
| | | | | | | | counter cache when deleting records
| * Fix problem where wrong keys are used in JoinAssociation when an association ↵Jon Leighton2010-12-201-0/+1
| | | | | | | | goes :through a belongs_to [#2801 state:resolved]
| * Fix various issues with the :primary_key option in :through associations ↵Jon Leighton2010-12-152-0/+13
| | | | | | | | [#2421 state:resolved]
| * Verify that creating a has_many through record where there is a ↵Jon Leighton2010-12-162-1/+14
| | | | | | | | default_scope on the join model works correctly (creates the join record with the default scope applied)
| * Respect the default_scope on a join model when reading a through associationJon Leighton2010-12-163-1/+12
| |
| * Fix hm:t to self table aliasing in construct_scopeErnie Miller2010-12-161-0/+1
| |
* | Merge branch 'master' into nested_has_many_throughJon Leighton2010-12-121-1/+5
|\| | | | | | | | | | | | | | | 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
| * fix warnings, stop using global variablesAaron Patterson2010-11-301-1/+5
| |
* | Merge branch 'master' into nested_has_many_throughJon Leighton2010-11-271-0/+8
|\| | | | | | | | | | | Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/associations.rb
| * If a nested_attribute is being marked for destruction and at the same time ↵Neeraj Singh2010-11-241-0/+8
| | | | | | | | | | | | | | | | an attr_accessor value is being assigned then the value being assigned is being ignored. This patch is a fix for that issue. [#5939 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* | Merge branch 'master' into nested_has_many_throughJon Leighton2010-11-174-4/+4
|\| | | | | | | | | | | Conflicts: activerecord/lib/active_record/associations/has_many_through_association.rb activerecord/test/cases/associations/has_many_through_associations_test.rb