Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | remove the nil check from set_inverse_instance | Aaron Patterson | 2013-12-12 | 1 | -1/+1 |
| | | | | | methods that call set_inverse_instance with a record will not have to pay the cost of a nil check on every call | ||||
* | read the association instead of sending | Aaron Patterson | 2013-10-14 | 1 | -1/+3 |
| | |||||
* | simplify populating the ordering hash | Aaron Patterson | 2013-10-14 | 1 | -10/+5 |
| | |||||
* | the preloader for the RHS has all the preloaded records, so ask it | Aaron Patterson | 2013-10-14 | 1 | -3/+3 |
| | |||||
* | only calculate offset index once. #12537 | Aaron Patterson | 2013-10-14 | 1 | -6/+10 |
| | |||||
* | Drop unused iterator var | Vipul A M | 2013-10-13 | 1 | -1/+1 |
| | |||||
* | remove the HABTM preloader | Aaron Patterson | 2013-10-02 | 1 | -71/+0 |
| | |||||
* | remove initialize method | Aaron Patterson | 2013-09-25 | 1 | -4/+0 |
| | |||||
* | extract association resetting to a method | Aaron Patterson | 2013-09-25 | 1 | -9/+16 |
| | |||||
* | hash insertion order doesn't matter anymore, so only loop over the | Aaron Patterson | 2013-09-25 | 1 | -4/+2 |
| | | | | owners once | ||||
* | always populate the preloaded records instance variable so we can remove | Aaron Patterson | 2013-09-25 | 2 | -10/+5 |
| | | | | the @associated_records_by_owner ivar | ||||
* | keep preloaded records in a list rather than extract from a hash | Aaron Patterson | 2013-09-25 | 3 | -16/+21 |
| | |||||
* | push slice loading to it's own method so we can remove the type casting | Aaron Patterson | 2013-09-24 | 2 | -24/+20 |
| | | | | code | ||||
* | guarantee that `klass` is not nil inside the preloader objects | Aaron Patterson | 2013-09-24 | 1 | -1/+1 |
| | |||||
* | eliminate unused ivar | Aaron Patterson | 2013-09-24 | 1 | -1/+0 |
| | |||||
* | all records have a preloaded, so eliminate that conditional | Aaron Patterson | 2013-09-24 | 1 | -11/+7 |
| | |||||
* | eliminate the `loaded?` conditional | Aaron Patterson | 2013-09-24 | 2 | -10/+1 |
| | |||||
* | push preloaded test up to the factory method so we can eliminate | Aaron Patterson | 2013-09-24 | 2 | -6/+4 |
| | | | | conditionals from the individual preloaded classes | ||||
* | we can't sort by lhs since the middle records have difference classes | Aaron Patterson | 2013-09-23 | 1 | -19/+19 |
| | | | | and possibly different rules for finding those objects | ||||
* | pass the preloader down so we only have to construct one | Aaron Patterson | 2013-09-23 | 6 | -19/+17 |
| | |||||
* | remove state from the preloader | Aaron Patterson | 2013-09-23 | 1 | -10/+9 |
| | |||||
* | only do the should_reset test once | Aaron Patterson | 2013-09-23 | 1 | -6/+6 |
| | |||||
* | fix variable names and speed up relation ordering | Aaron Patterson | 2013-09-23 | 2 | -16/+12 |
| | |||||
* | hm:t preloading will respect order set on the RHS association | Aaron Patterson | 2013-09-23 | 4 | -7/+52 |
| | |||||
* | cache associated target records hash | Aaron Patterson | 2013-09-20 | 1 | -17/+11 |
| | |||||
* | combine methods so we can reuse preloaders | Aaron Patterson | 2013-09-20 | 1 | -19/+18 |
| | |||||
* | return a list rather than hash | Aaron Patterson | 2013-09-20 | 1 | -7/+13 |
| | |||||
* | preserve order on the RHS query | Aaron Patterson | 2013-09-20 | 1 | -0/+8 |
| | |||||
* | split up construction and mutation | Aaron Patterson | 2013-09-20 | 1 | -1/+4 |
| | |||||
* | push `run` up to preload | Aaron Patterson | 2013-09-20 | 2 | -4/+11 |
| | |||||
* | exposing target records on the preloader | Aaron Patterson | 2013-09-20 | 2 | -16/+29 |
| | |||||
* | correctly typecast keys, remove conditionals, reduce object allocations | Aaron Patterson | 2013-08-28 | 2 | -7/+11 |
| | |||||
* | no need to to_a the scope | Aaron Patterson | 2013-08-28 | 1 | -1/+1 |
| | |||||
* | remove extra flat_map array | Aaron Patterson | 2013-08-28 | 1 | -8/+9 |
| | |||||
* | avoid extra empty array allocation | Aaron Patterson | 2013-08-28 | 1 | -10/+10 |
| | |||||
* | extract owner id calculation to a method | Aaron Patterson | 2013-08-28 | 1 | -1/+5 |
| | |||||
* | only call to_a when we have to | Aaron Patterson | 2013-08-28 | 2 | -2/+6 |
| | |||||
* | remove intermediate variable | Aaron Patterson | 2013-08-27 | 1 | -3/+1 |
| | |||||
* | cache association reset calculation | Aaron Patterson | 2013-08-27 | 1 | -4/+4 |
| | |||||
* | query the association rather than send the method for the association name | Aaron Patterson | 2013-08-27 | 1 | -5/+6 |
| | |||||
* | use flat_map | Neeraj Singh | 2013-08-03 | 1 | -1/+1 |
| | |||||
* | don't shadow `through_scope` method name with local var. | Yves Senn | 2013-06-30 | 1 | -7/+7 |
| | |||||
* | Simplify/fix implementation of default scopes | Jon Leighton | 2013-06-28 | 1 | -2/+1 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous implementation was necessary in order to support stuff like: class Post < ActiveRecord::Base default_scope where(published: true) scope :ordered, order("created_at") end If we didn't evaluate the default scope at the last possible moment before sending the SQL to the database, it would become impossible to do: Post.unscoped.ordered This is because the default scope would already be bound up in the "ordered" scope, and therefore wouldn't be removed by the "Post.unscoped" part. In 4.0, we have deprecated all "eager" forms of scopes. So now you must write: class Post < ActiveRecord::Base default_scope { where(published: true) } scope :ordered, -> { order("created_at") } end This prevents the default scope getting bound up inside the "ordered" scope, which means we can now have a simpler/better/more natural implementation of default scoping. A knock on effect is that some things that didn't work properly now do. For example it was previously impossible to use #except to remove a part of the default scope, since the default scope was evaluated after the call to #except. | ||||
* | Avoid iterating over records hash when not necessary | Carlos Antonio da Silva | 2013-04-07 | 1 | -2/+6 |
| | | | | | | If the reflection scope is not flagged with distinct value, there is no need to iterate over the records, so we avoid that by doing the check before iterating rather than inside the iteration block. | ||||
* | each to each_value; remove unused vars | Vipul A M | 2013-04-07 | 1 | -1/+1 |
| | |||||
* | 1. Change from each to each_value since we did not use key | Vipul A M | 2013-03-19 | 1 | -1/+1 |
| | | | | 2. drop assignment of value to sum in test | ||||
* | rename `Relation#uniq` to `Relation#distinct`. `#uniq` still works. | Yves Senn | 2013-03-15 | 1 | -1/+1 |
| | | | | | | | | The similarity of `Relation#uniq` to `Array#uniq` is confusing. Since our Relation API is close to SQL terms I renamed `#uniq` to `#distinct`. There is no deprecation. `#uniq` and `#uniq!` are aliases and will continue to work. I also updated the documentation to promote the use of `#distinct`. | ||||
* | don't apply invalid ordering when preloading hmt associations. | Yves Senn | 2013-02-24 | 1 | -2/+2 |
| | | | | | | | | | | | | | | | closes #8663. When preloading a hmt association there two possible scenarios: 1.) preload with 2 queries: first hm association, then hmt with id IN () 2.) preload with join: hmt association is loaded with a join on the hm association The bug was happening in scenario 1.) with a normal order clause on the hmt association. The ordering was also applied when loading the hm association, which resulted in the error. This patch only applies the ordering the the hm-relation if we are performing a join (2). Otherwise the order will only appear in the second query (1). | ||||
* | don't cache invalid subsets when preloading hmt associations. | Yves Senn | 2013-02-14 | 1 | -1/+2 |
| | | | | closes #8423. | ||||
* | Eager loading made to use relation's in_clause_length instead of host's one ↵ | Boris Staal | 2012-12-20 | 1 | -1/+1 |
| | | | | (fixes #8474) |