aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/join_dependency/join_association.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* stop reversing tables until we absolutely mustAaron Patterson2013-10-151-2/+2
|
* pass the chain the join_constraintsAaron Patterson2013-10-151-2/+2
|
* move column_names_with_alias on to the alias cache objectAaron Patterson2013-10-141-5/+1
|
* remove delegation to `chain`Aaron Patterson2013-10-141-3/+1
|
* rm JoinHelper from JoinAssociationAaron Patterson2013-10-141-3/+1
|
* unhook `join_constraints` from the @tables ivarAaron Patterson2013-10-131-2/+2
|
* remove delegate methods that are not usedAaron Patterson2013-10-131-1/+1
|
* pull parent and alias tacker from the nodes.Aaron Patterson2013-10-111-9/+4
| | | | For now, we'll set the tables on the nodes manually.
* decouple the `join_constraints` method from the parent pointerAaron Patterson2013-10-111-1/+1
|
* stop creating a bunch of relation objects when we can slap all the joins on ↵Aaron Patterson2013-10-091-5/+0
| | | | at once
* speed up match?Aaron Patterson2013-10-091-0/+1
|
* make node search more efficientAaron Patterson2013-10-091-0/+4
| | | | | | Rather than search every node in the tree, comparing that node and all of its parents every time, start at the root from both sides and work our way down the tree
* remove == so we can see where walking up parents occursAaron Patterson2013-10-091-6/+0
|
* push parent up to the superclassAaron Patterson2013-10-091-6/+1
| | | | We always want a linked list back to the root node.
* hide join_parts internals from other classesAaron Patterson2013-10-081-11/+0
|
* decouple JoinAssociation from JoinDependencyAaron Patterson2013-10-081-9/+4
|
* Set the join type on constructionAaron Patterson2013-10-031-2/+2
| | | | | We always set the join type immediately after construction, just make it part of the constructor and we can skip that step
* simplify the JoinAssociation constructor, check validity *before*Aaron Patterson2013-10-031-6/+0
|
* parent is always passed in, so make it non-optionalAaron Patterson2013-10-031-1/+1
|
* require the files we need so the classes are stand-aloneAaron Patterson2013-10-031-0/+2
|
* remove HABTM special cases from associations classesAaron Patterson2013-10-021-11/+0
|
* add a specific factory method rather than using newAaron Patterson2013-07-231-2/+2
|
* parent_table is only used internallyAaron Patterson2013-07-161-4/+4
|
* decouple the manager class from building join constraintsAaron Patterson2013-07-161-6/+6
|
* cache the klass member of the reflectionAaron Patterson2013-07-161-8/+10
|
* cache the scope chain on the stack and eliminate `i`Aaron Patterson2013-07-161-7/+4
|
* just push on to the scope chain items. Oops! (thanks @carlosantoniodasilva)Aaron Patterson2013-07-161-2/+1
|
* use Relation#merge to combine scope chain itemsAaron Patterson2013-07-161-6/+6
|
* make sure scope_chain_items has consistent typesAaron Patterson2013-07-161-7/+9
|
* Apply default scope when joining associations.Jon Leighton2013-06-281-0/+2
| | | | | | | | | | | | | | | | | | | For example: class Post < ActiveRecord::Base default_scope -> { where published: true } end class Comment belongs_to :post end When calling `Comment.join(:post)`, we expect to receive only comments on published posts, since that is the default scope for posts. Before this change, the default scope from `Post` was not applied, so we'd get comments on unpublished posts.
* stop doing assingments in an iteratorAaron Patterson2013-05-171-2/+6
|
* rdoc for some of the methods in JoinDependencyNeeraj Singh2013-04-101-0/+15
|
* While merging relations preserve context for joinsJared Armstrong and Neeraj Singh2013-04-101-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #3002. Also see #5494. ``` class Comment < ActiveRecord::Base belongs_to :post end class Author < ActiveRecord::Base has_many :posts end class Post < ActiveRecord::Base belongs_to :author has_many :comments end ``` `Comment.joins(:post).merge(Post.joins(:author).merge(Author.where(:name => "Joe Blogs"))).all` would fail with `ActiveRecord::ConfigurationError: Association named 'author' was not found on Comment`. It is failing because `all` is being called on relation which looks like this after all the merging: `{:joins=>[:post, :author], :where=>[#<Arel::Nodes::Equality: ....}`. In this relation all the context that `Post` was joined with `Author` is lost and hence the error that `author` was not found on `Comment`. Ths solution is to build JoinAssociation when two relations with join information are being merged. And later while building the arel use the previously built `JoinAssociation` record in `JoinDependency#graft` to build the right from clause. Thanks to Jared Armstrong (https://github.com/armstrjare) for most of the work. I ported it to make it compatible with new code base.
* changed variable name active_record => base_klassNeeraj Singh2013-04-091-1/+1
| | | | | | | | | | | | | | | | | Current code stores the klass name in active_record and this is used throughout. While reviewing the code time and again I had the mental picture of active_record being an instance of a klass. However here the actual klass is being stored in @active_record. Secondly at two different places while referring to @active_record the comment refers to it as base klass. All this points to active_record being not the best variable name. So I thought it is better to replace active_record with base_klass. This change is confined to JoinDependency, JoinBase, JoinPart and JoinAssociation - all joining related work.
* not a relation. it's an arel select managerNeeraj Singh2013-04-021-4/+4
|
* Represent association scope options as AR::Relations insternally.Jon Leighton2012-07-131-18/+15
|
* Revert "Merge pull request #5494 from ↵Jon Leighton2012-05-051-6/+1
| | | | | | | armstrjare/active_record_relation_keep_association_join_context_on_merge" This reverts commit dcd04e76179611a9db28c9e391aa7d6c2a5b046a, reversing changes made to 58a49875df63729f07a9a81d1ee349087d258df5.
* Allow ActiveRecord::Relation merges to maintain context of joined associationsJared Armstrong2012-05-041-1/+6
|
* Avoid sanitize_sql when we can use Relation#where insteadJon Leighton2012-01-161-2/+5
|
* Fix problem with loading polymorphic associations which have been defined in ↵Jon Leighton2011-05-221-3/+7
| | | | an abstract superclass. Fixes #552.
* Add join conditions to JOIN clause, not WHEREErnie Miller2011-05-051-3/+3
|
* Extract the constraint-building for joins in JoinAssociation into a separate ↵Jon Leighton2011-04-141-8/+14
| | | | method to make it easy to change/override (requested by Ernie Miller so that MetaWhere can add to it easily)
* Fix tests under postgres - we should always put conditions in the WHERE part ↵Jon Leighton2011-03-121-8/+11
| | | | not in ON constraints because postgres requires that the table has been joined before the condition references it.
* Abstract some common code from AssociationScope and ↵Jon Leighton2011-03-111-53/+12
| | | | JoinDependency::JoinAssociation into a JoinHelper module
* Refactor JoinAssociationJon Leighton2011-03-101-100/+54
|
* Rename Reflection#through_reflection_chain and #through_options to ↵Jon Leighton2011-03-101-9/+7
| | | | Reflection#chain and Reflection#options as they now no longer relate solely to through associations.
* Use Base#type_condition in JoinAssociationJon Leighton2011-03-051-15/+4
|
* Push source_type and polymorphic conditions out of ThroughAssociation and ↵Jon Leighton2011-03-051-18/+0
| | | | JoinDependency::JoinAssociation and into the reflection instead.
* Merge branch 'master' into nested_has_many_throughJon Leighton2011-03-041-177/+157
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Move JoinDependency and friends from ↵Jon Leighton2011-02-281-0/+279
ActiveRecord::Associations::ClassMethods to just ActiveRecord::Associations