aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/join_dependency
Commit message (Collapse)AuthorAgeFilesLines
...
* delete unused codeAaron Patterson2013-10-101-10/+0
| | | | | Now that we merge trees from the top down, we don't need to search through the whole tree for particular nodes, just walk it and merge.
* simplify each method.Aaron Patterson2013-10-101-8/+2
| | | | Stop writing terrible code Aaron. This is Ruby, not Scheme
* stop creating a bunch of relation objects when we can slap all the joins on ↵Aaron Patterson2013-10-091-5/+0
| | | | at once
* add some convenient methods for avoiding array allocationsAaron Patterson2013-10-091-0/+3
|
* speed up match?Aaron Patterson2013-10-091-0/+1
|
* make node search more efficientAaron Patterson2013-10-093-0/+23
| | | | | | 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-093-15/+0
|
* push parent up to the superclassAaron Patterson2013-10-093-7/+11
| | | | We always want a linked list back to the root node.
* convert JoinBase to a tree and remove the Node classAaron Patterson2013-10-091-1/+19
|
* don't access the reflections hashAaron Patterson2013-10-081-1/+1
| | | | The reflections hash is supposed to be private, so let's use the API.
* 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-032-0/+4
|
* remove HABTM special cases from associations classesAaron Patterson2013-10-021-11/+0
|
* WhitespacesRafael Mendonça França2013-09-111-1/+2
|
* Reduce allocations when extracting AR modelsSam2013-09-111-1/+13
|
* 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
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2013-04-111-1/+1
|\ | | | | | | | | Conflicts: guides/source/action_mailer_basics.md
| * JoinPart is no longer an abstract classNeeraj Singh2013-04-081-1/+1
| |
* | 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-093-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
|/
* No need to send public methodsAkira Matsuda2013-02-261-1/+1
|
* Merge pull request #4976 from kreynolds/fix_eager_without_pkeyJon Leighton2012-09-071-1/+1
|\ | | | | Fix eagerly loading associations without primary keys
| * Fix eagerly loading associations without primary keysKelley Reynolds2012-02-091-1/+1
| |
* | 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)
* TableAlias leg ordering has changed, so change accordinglyAaron Patterson2011-03-301-1/+1
|
* 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.