Commit message (Collapse) | Author | Age | Files | Lines | ||
---|---|---|---|---|---|---|
... | ||||||
* | delete unused code | Aaron Patterson | 2013-10-10 | 1 | -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 Patterson | 2013-10-10 | 1 | -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 Patterson | 2013-10-09 | 1 | -5/+0 | |
| | | | | at once | |||||
* | add some convenient methods for avoiding array allocations | Aaron Patterson | 2013-10-09 | 1 | -0/+3 | |
| | ||||||
* | speed up match? | Aaron Patterson | 2013-10-09 | 1 | -0/+1 | |
| | ||||||
* | make node search more efficient | Aaron Patterson | 2013-10-09 | 3 | -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 occurs | Aaron Patterson | 2013-10-09 | 3 | -15/+0 | |
| | ||||||
* | push parent up to the superclass | Aaron Patterson | 2013-10-09 | 3 | -7/+11 | |
| | | | | We always want a linked list back to the root node. | |||||
* | convert JoinBase to a tree and remove the Node class | Aaron Patterson | 2013-10-09 | 1 | -1/+19 | |
| | ||||||
* | don't access the reflections hash | Aaron Patterson | 2013-10-08 | 1 | -1/+1 | |
| | | | | The reflections hash is supposed to be private, so let's use the API. | |||||
* | hide join_parts internals from other classes | Aaron Patterson | 2013-10-08 | 1 | -11/+0 | |
| | ||||||
* | decouple JoinAssociation from JoinDependency | Aaron Patterson | 2013-10-08 | 1 | -9/+4 | |
| | ||||||
* | Set the join type on construction | Aaron Patterson | 2013-10-03 | 1 | -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 Patterson | 2013-10-03 | 1 | -6/+0 | |
| | ||||||
* | parent is always passed in, so make it non-optional | Aaron Patterson | 2013-10-03 | 1 | -1/+1 | |
| | ||||||
* | require the files we need so the classes are stand-alone | Aaron Patterson | 2013-10-03 | 2 | -0/+4 | |
| | ||||||
* | remove HABTM special cases from associations classes | Aaron Patterson | 2013-10-02 | 1 | -11/+0 | |
| | ||||||
* | Whitespaces | Rafael Mendonça França | 2013-09-11 | 1 | -1/+2 | |
| | ||||||
* | Reduce allocations when extracting AR models | Sam | 2013-09-11 | 1 | -1/+13 | |
| | ||||||
* | add a specific factory method rather than using new | Aaron Patterson | 2013-07-23 | 1 | -2/+2 | |
| | ||||||
* | parent_table is only used internally | Aaron Patterson | 2013-07-16 | 1 | -4/+4 | |
| | ||||||
* | decouple the manager class from building join constraints | Aaron Patterson | 2013-07-16 | 1 | -6/+6 | |
| | ||||||
* | cache the klass member of the reflection | Aaron Patterson | 2013-07-16 | 1 | -8/+10 | |
| | ||||||
* | cache the scope chain on the stack and eliminate `i` | Aaron Patterson | 2013-07-16 | 1 | -7/+4 | |
| | ||||||
* | just push on to the scope chain items. Oops! (thanks @carlosantoniodasilva) | Aaron Patterson | 2013-07-16 | 1 | -2/+1 | |
| | ||||||
* | use Relation#merge to combine scope chain items | Aaron Patterson | 2013-07-16 | 1 | -6/+6 | |
| | ||||||
* | make sure scope_chain_items has consistent types | Aaron Patterson | 2013-07-16 | 1 | -7/+9 | |
| | ||||||
* | Apply default scope when joining associations. | Jon Leighton | 2013-06-28 | 1 | -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 iterator | Aaron Patterson | 2013-05-17 | 1 | -2/+6 | |
| | ||||||
* | Merge branch 'master' of github.com:lifo/docrails | Vijay Dev | 2013-04-11 | 1 | -1/+1 | |
|\ | | | | | | | | | Conflicts: guides/source/action_mailer_basics.md | |||||
| * | JoinPart is no longer an abstract class | Neeraj Singh | 2013-04-08 | 1 | -1/+1 | |
| | | ||||||
* | | rdoc for some of the methods in JoinDependency | Neeraj Singh | 2013-04-10 | 1 | -0/+15 | |
| | | ||||||
* | | While merging relations preserve context for joins | Jared Armstrong and Neeraj Singh | 2013-04-10 | 1 | -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_klass | Neeraj Singh | 2013-04-09 | 3 | -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 manager | Neeraj Singh | 2013-04-02 | 1 | -4/+4 | |
|/ | ||||||
* | No need to send public methods | Akira Matsuda | 2013-02-26 | 1 | -1/+1 | |
| | ||||||
* | Merge pull request #4976 from kreynolds/fix_eager_without_pkey | Jon Leighton | 2012-09-07 | 1 | -1/+1 | |
|\ | | | | | Fix eagerly loading associations without primary keys | |||||
| * | Fix eagerly loading associations without primary keys | Kelley Reynolds | 2012-02-09 | 1 | -1/+1 | |
| | | ||||||
* | | Represent association scope options as AR::Relations insternally. | Jon Leighton | 2012-07-13 | 1 | -18/+15 | |
| | | ||||||
* | | Revert "Merge pull request #5494 from ↵ | Jon Leighton | 2012-05-05 | 1 | -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 associations | Jared Armstrong | 2012-05-04 | 1 | -1/+6 | |
|/ | ||||||
* | Avoid sanitize_sql when we can use Relation#where instead | Jon Leighton | 2012-01-16 | 1 | -2/+5 | |
| | ||||||
* | Fix problem with loading polymorphic associations which have been defined in ↵ | Jon Leighton | 2011-05-22 | 1 | -3/+7 | |
| | | | | an abstract superclass. Fixes #552. | |||||
* | Add join conditions to JOIN clause, not WHERE | Ernie Miller | 2011-05-05 | 1 | -3/+3 | |
| | ||||||
* | Extract the constraint-building for joins in JoinAssociation into a separate ↵ | Jon Leighton | 2011-04-14 | 1 | -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 accordingly | Aaron Patterson | 2011-03-30 | 1 | -1/+1 | |
| | ||||||
* | Fix tests under postgres - we should always put conditions in the WHERE part ↵ | Jon Leighton | 2011-03-12 | 1 | -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 Leighton | 2011-03-11 | 1 | -53/+12 | |
| | | | | JoinDependency::JoinAssociation into a JoinHelper module | |||||
* | Refactor JoinAssociation | Jon Leighton | 2011-03-10 | 1 | -100/+54 | |
| | ||||||
* | Rename Reflection#through_reflection_chain and #through_options to ↵ | Jon Leighton | 2011-03-10 | 1 | -9/+7 | |
| | | | | Reflection#chain and Reflection#options as they now no longer relate solely to through associations. |