aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/join_dependency
Commit message (Collapse)AuthorAgeFilesLines
* modernizes hash syntax in activerecordXavier Noria2016-08-061-1/+1
|
* applies new string literal convention in activerecord/libXavier Noria2016-08-062-2/+2
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Remove circular join references in join_dependencyTakashi Kokubun2016-07-281-1/+3
| | | | Fixes #25653.
* Merge pull request #18109 from k0kubun/unscoped-joinsSean Griffin2016-02-111-6/+12
|\ | | | | | | | | | | Allow `joins` to be unscoped Fixes #13775
| * Allow `joins` to be unscopedTakashi Kokubun2016-01-311-6/+12
| |
* | Defer Arel attribute lookup to the model classMatthew Draper2016-02-041-1/+1
|/ | | | | This still isn't as separated as I'd like, but it at least moves most of the burden of alias mapping in one place.
* `substitute_at` is no longer usedRyuta Kamizono2016-01-141-2/+1
| | | | Arel handles substitution for bind parameters by now.
* Remove Relation#bind_paramsSean Griffin2015-01-271-1/+1
| | | | | | | | `bound_attributes` is now used universally across the board, removing the need for the conversion layer. These changes are mostly mechanical, with the exception of the log subscriber. Additional, we had to implement `hash` on the attribute objects, so they could be used as a key for query caching.
* Use an `Attribute` object to represent a bind valueSean Griffin2015-01-271-4/+4
| | | | | | | | | | | The column is primarily used for type casting, which we're trying to separate from the idea of a column. Since what we really need is the combination of a name, type, and value, let's use the object that we already have to represent that concept, rather than this tuple. No consumers of the bind values have been changed, only the producers (outside of tests which care too much about internals). This is *finally* possible since the bind values are now produced from a reasonable number of lcoations.
* Remove `klass` and `arel_table` as a dependency of `PredicateBuilder`Sean Griffin2014-12-261-1/+1
| | | | | | | | | | | | | | | This class cares far too much about the internals of other parts of Active Record. This is an attempt to break out a meaningful object which represents the needs of the predicate builder. I'm not fully satisfied with the name, but the general concept is an object which represents a table, the associations to/from that table, and the types associated with it. Many of these exist at the `ActiveRecord::Base` class level, not as properties of the table itself, hence the need for another object. Currently it provides these by holding a reference to the class, but that will likely change in the future. This allows the predicate builder to remain wholy concerned with building predicates. /cc @mrgilman
* Inject the `PredicateBuilder` into the `Relation` instanceSean Griffin2014-12-261-2/+9
| | | | | | | Construction of relations can be a hotspot, we don't want to create one of these in the constructor. This also allows us to do more expensive things in the predicate builder's constructor, since it's created once per AR::Base subclass
* Remove the unused second argument to `substitute_at`Sean Griffin2014-11-171-1/+1
| | | | Oh hey, we got to remove some code because of that!
* Remove defunct ivarsBen Woosley2014-09-281-1/+0
| | | | @column_names_with_alias, @dynamic_methods_hash, @time_zone_column_names, and @cached_time_zone
* Fixed regression with referencing polymorphic assoc in eager-loadGodfrey Chan2014-09-051-1/+1
| | | | | | | | | | | | This is cased by 03118bc + 9b5d603. The first commit referenced the undefined local variable `column` when it should be using `reflection.type` as the lookup key. The second commit changed `build_arel` to not modify the `bind_values` in- place so we need to combine the arel's `bind_values` with the relation's when building the SQL. Fixes #16591 Related #15821 / #15892 / 7aeca50
* Merge pull request #16378 from ↵Rafael Mendonça França2014-08-021-1/+1
|\ | | | | | | | | JackDanger/doc-fix-in-join-association-build_constraint [doc] updating documented parameter for build_constraint
| * updating documented parameter for build_constraintJack Danger Canty2014-08-021-1/+1
| | | | | | | | | | Updates documentation in line with changes made in 743b67508e2027e1d086142ccbec47a19fc943f6
* | Refactor join_keys to remove complex conditionalseileencodes2014-07-311-8/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | Pushing conditionals down to through reflection Only the through association needs the part of this conditional that deals with belongs to and polymorphic? so that can be pushed down into the ThroughReflection reducing the conditionals. Remove conditional because we can delegate join keys to source reflection Remove need for source_macro checking By adding join_id_for to the other reflections we remove the need to cehck against the source_macro and can reduce the conditioanl from the original join_id_for(owner) Using polymorphism instead of testing the source_macro This case statement in join_association is almost exactly the same as the original join_keys code. Testing taht theory by creating a new join_dependency_keys(assoc_klass) method. Refactor join_keys further to be more concise Fixed format of "#:nodoc:" to "# :nodoc:" where I added them to this file.
* [ci skip] Fix documentation for @macro and reflection typeseileencodes2014-07-271-1/+1
| | | | | | | | Since `@macro` doesn't exist anymore and these reflections are no longer AssociationReflections but their own types of reflections based on macro I updated the documentation to match the changes I made in #16089 and #16198. An `AssociationReflection` that had a `@macro` of `:has_many` now is a `HasManyReflection`
* 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-212-4/+4
| | | | 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
|
* Merge branch 'master' into joindepAaron Patterson2013-10-152-2/+2
|\ | | | | | | | | | | | | | | | | | | | | * master: use the cached arel table Fix typo in the changelog entry Don't remove the select values to add they back again Pluck on NullRelation accepts a list of columns Conflicts: activerecord/lib/active_record/relation/finder_methods.rb
| * use the cached arel tableAaron Patterson2013-10-152-2/+2
| |
* | move column_names_with_alias on to the alias cache objectAaron Patterson2013-10-143-29/+4
| |
* | keep a cache on the alias objectAaron Patterson2013-10-141-5/+0
| |
* | move alias building to the table nodeAaron Patterson2013-10-141-4/+0
| |
* | 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
| |
* | push the node->AR cache up one levelAaron Patterson2013-10-131-6/+1
| |
* | pull parent and alias tacker from the nodes.Aaron Patterson2013-10-113-19/+5
| | | | | | | | 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
|/
* no reason to do this column addition and subtraction businessAaron Patterson2013-10-111-1/+1
|
* refactor a little so we can remove some methodsAaron Patterson2013-10-101-3/+0
|