aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/join_dependency/join_association.rb
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' into adequaterecordAaron Patterson2014-04-071-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (122 commits) Rails.application should be set inside before_configuration hook remove check for present? from delete_all Remove useless begin..end Build the reverse_order on its proper method. Use connection-specific bytea escaping Ignore order when doing count. make enums distinct per class Remove unused `subclass_controller_with_flash_type_bar` var from flash test. fix CollectionProxy delete_all documentation Added OS X specific commands to installation guide [ci skip] Recommended using homebrew for installing MySQL and PostgreSQL Fix setup of adding _flash_types test. Use SVG version of travis build status badge [skip ci] W3C CSP document moved to gihub.io URL [ci skip] sprockets-rails was released Fix the test defining the models in the right place Add CHANGELOG entry for #11650 [ci skip] Declare the assets dependency Use sass-rails 4.0.3 Make possible to use sprockets-rails 2.1 add missing parentheses to validates_with documentation [skip ci] ...
| * Pass a base relation to build_default_scope when joiningMatt Jones2014-02-211-1/+1
| | | | | | | | | | This allows the default scope to be built using the current table alias. Resolves #12770
* | Merge branch 'master' into adequaterecordAaron Patterson2014-02-171-2/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (311 commits) Add a missing changelog entry for #13981 and #14035 Revert "Fixed plugin_generator test" implements new option :month_format_string for date select helpers [Closes #13618] add factory methods for empty alias trackers guarantee a list in the alias tracker so we can remove a conditional stop exposing table_joins make most parameters to the AliasTracker required make a singleton for AssociationScope pass the association and connection to the scope method pass the tracker down the stack and construct it in the scope method clean up add_constraints signature remove the reflection delegate remove klass delegator remove railties changes. fixes #14054 remove chain delegate remove scope_chain delegate Add verb to sanitization note fix path shown in mailer's templates updated Travis build status image url fix guide active_support_core_extensions. add Note to String#indent [ci skip] ... Conflicts: activerecord/lib/active_record/associations/join_dependency.rb activerecord/test/cases/associations/association_scope_test.rb
| * Dont use Enumarator on join_associationArthur Neves2014-02-131-2/+4
| |
* | expliticly make STI column a bind valueAaron Patterson2014-01-141-4/+9
| |
* | Merge branch 'master' into set_bindsAaron Patterson2014-01-141-6/+4
|\| | | | | | | | | | | * master: directly create the ARel AST Updated comment to mention the enum mapping class method [ci skip]
| * directly create the ARel ASTAaron Patterson2014-01-141-6/+4
| | | | | | | | rather than allocating a new Relation, just make the AST directly
* | adding bind values to the manager objectAaron Patterson2014-01-131-5/+2
| |
* | bubble bind parameters up when building join dependenciesAaron Patterson2014-01-131-3/+10
|/
* Change syntax format for example returned valuesPrem Sichanugrist2013-11-111-5/+5
| | | | | | | | | According to our guideline, we leave 1 space between `#` and `=>`, so we want `# =>` instead of `#=>`. Thanks to @fxn for the suggestion. [ci skip]
* build the association graph functionallyAaron Patterson2013-10-211-2/+2
| | | | This lets us avoid the constant calls to Array#<<
* join_type isn't used on the node anymoreAaron Patterson2013-10-211-5/+1
|
* disconnect join_constraints from the instanceAaron Patterson2013-10-201-2/+2
|
* pass in scope chain so reflection is not neededAaron Patterson2013-10-201-2/+2
|
* pass the foreign table and class to the join_constraints methodAaron Patterson2013-10-201-4/+1
|
* pass the join type to the join_constraints methodAaron Patterson2013-10-201-1/+1
|
* 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.