Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Remove unused delegation to `reflection.options` in `Preloader::Association` | Ryuta Kamizono | 2017-09-18 | 1 | -0/+1 |
| | |||||
* | Don't pass `reflection_scope` to `preload_scope` if `reflection.scope` isn't ↵ | Ryuta Kamizono | 2017-09-18 | 1 | -1/+3 |
| | | | | | | | | | given Related 2b5f5cdd7c1d95716de6a206b6d09ccbb006dc17. If `reflection.scope` isn't given, `reflection_scope` is always empty scope. It is unnecessary to merge it. | ||||
* | Return `through_scope` only if the scope is not empty scope | Ryuta Kamizono | 2017-09-18 | 1 | -4/+2 |
| | | | | | | | | | Related 2b5f5cdd7c1d95716de6a206b6d09ccbb006dc17. If `through_scope` is empty scope, it is unnecessary to merge it. And also, comparing relations is a little expensive (will cause `build_arel`). It is enough to use `empty_scope?` to determine whether empty scope. | ||||
* | Remove useless condition in `reset_association` | Ryuta Kamizono | 2017-09-18 | 1 | -2/+1 |
| | | | | `through_scope` is not empty scope if `options[:source_type]` is given. | ||||
* | Assigning `values` is only necessary when `reflection_scope.where_clause` is ↵ | Ryuta Kamizono | 2017-09-05 | 1 | -1/+1 |
| | | | | | | not empty Because `reflection_scope.values` will create extra new hash. | ||||
* | Fix preloading through association with custom scope | Ryuta Kamizono | 2017-09-02 | 1 | -1/+6 |
| | | | | | | | | | | If `reflection_scope.where_clause` is not empty, `through_scope` should be joined the source association. But if `values[:references]` in `reflection_scope` is empty, the source association will not be joined. It should use `source_reflection.table_name` in that case. Fixes #22535. Closes #28763. | ||||
* | `values[:includes]` in `reflection_scope` is not compatible with `through_scope` | Ryuta Kamizono | 2017-09-02 | 1 | -1/+6 |
| | | | | | | | | | | | | | | | | | Without this fix, preloading `:comments_with_include` will cause the following error: ``` % bundle exec ruby -w -Itest test/cases/associations/eager_test.rb -n test_eager_with_has_many_through_join_model_with_include Using sqlite3 Run options: -n test_eager_with_has_many_through_join_model_with_include --seed 1502 E Error: EagerAssociationTest#test_eager_with_has_many_through_join_model_with_include: ActiveRecord::AssociationNotFoundError: Association named 'post' was not found on Post; perhaps you misspelled it? ``` | ||||
* | Don't call `scope.eager_loading?` when `reflection_scope.where_clause` is empty | Ryuta Kamizono | 2017-09-02 | 1 | -10/+10 |
| | | | | | If `reflection_scope.where_clause` is empty, `scope` isn't changed. So `scope.eager_loading?` is always false. | ||||
* | Use frozen-string-literal in ActiveRecord | Kir Shatrov | 2017-07-19 | 1 | -0/+2 |
| | |||||
* | Fix preloading association with scope including joins | Ryuta Kamizono | 2017-07-04 | 1 | -3/+10 |
| | |||||
* | Revert "Merge pull request #29540 from kirs/rubocop-frozen-string" | Matthew Draper | 2017-07-02 | 1 | -1/+0 |
| | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa. | ||||
* | Enforce frozen string in Rubocop | Kir Shatrov | 2017-07-01 | 1 | -0/+1 |
| | |||||
* | Merge pull request #29129 from kamipo/prevent_extra_through_scope | Rafael França | 2017-06-28 | 1 | -2/+4 |
|\ | | | | | Prevent extra `through_scope` | ||||
| * | Prevent extra `through_scope` | Ryuta Kamizono | 2017-05-18 | 1 | -2/+4 |
| | | | | | | | | We can reuse `through_scope` for `reset_association`. | ||||
* | | Don't expose methods and attrs for internal usage | Ryuta Kamizono | 2017-05-30 | 1 | -1/+1 |
|/ | |||||
* | Remove useless `target_records_from_association` | Ryuta Kamizono | 2017-05-04 | 1 | -11/+3 |
| | | | | Since through association is always loaded by `preloader.preload`. | ||||
* | Add more rubocop rules about whitespaces | Rafael Mendonça França | 2016-10-29 | 1 | -3/+3 |
| | |||||
* | Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty lines | Ryuta Kamizono | 2016-08-07 | 1 | -1/+0 |
| | |||||
* | normalizes indentation and whitespace across the project | Xavier Noria | 2016-08-06 | 1 | -32/+32 |
| | |||||
* | Merge pull request #18766 from yasyf/issue_17864 | Sean Griffin | 2016-02-29 | 1 | -8/+15 |
|\ | | | | | | | | | Honour joining model order in `has_many :through` associations when eager loading | ||||
| * | Honour the order of the joining model in a `has_many :through` | Yasyf Mohamedali | 2015-03-02 | 1 | -8/+15 |
| | | | | | | | | | | | | | | | | | | association when eager loading. Previously, eager loading a `has_many :through` association with no defined order would return the records in the natural order of the database. Now, these records will be returned in the order that the joining record is returned, in case there is a defined order there. | ||||
* | | Merge pull request #19423 from ↵ | Aaron Patterson | 2015-12-18 | 1 | -2/+7 |
|\ \ | | | | | | | | | | | | | yuroyoro/fix_performance_regression_of_preloading_has_many_through_relation Fix #12537 performance regression when preloading has_many_through association | ||||
| * | | Read already loaded association records from association.target | Tomohito Ozaki | 2015-04-17 | 1 | -2/+7 |
| |/ | | | | | | | | | For performance, Avoid instantiate CollectionProxy. Fixes #12537 | ||||
* / | Never pass `nil` to `order` | Sean Griffin | 2015-10-29 | 1 | -1/+3 |
|/ | | | | | | | | This is part of a refactoring to make it easier to allow `order` to use sanitize like just about everything else on relation. The deleted test doesn't give any reasoning as to why passing `nil` to `order` needs to be supported, and it's rather nonsensical. I can almost see allowing an empty string being passed (though I'm tempted to just disallow it...) | ||||
* | Remove all references to `where_values` in association code | Sean Griffin | 2015-01-25 | 1 | -3/+2 |
| | |||||
* | Don't access the where values hash directly in through associations | Sean Griffin | 2015-01-25 | 1 | -1/+1 |
| | | | | See 4d7a62293e148604045a5f78a9d4312e79e90d13 for the reasoning | ||||
* | Use bind values for joined tables in where statements | Sean Griffin | 2014-11-01 | 1 | -0/+1 |
| | | | | | | | | | | | | | | | In practical terms, this allows serialized columns and tz aware columns to be used in wheres that go through joins, where they previously would not behave correctly. Internally, this removes 1/3 of the cases where we rely on Arel to perform type casting for us. There were two non-obvious changes required for this. `update_all` on relation was merging its bind values with arel's in the wrong order. Additionally, through associations were assuming there would be no bind parameters in the preloader (presumably because the where would always be part of a join) [Melanie Gilman & Sean Griffin] | ||||
* | Spelling errors | jbsmith86 | 2014-08-14 | 1 | -1/+1 |
| | |||||
* | reset `@arel` when modifying a Relation in place. | Yves Senn | 2014-04-24 | 1 | -1/+1 |
| | | | | /cc @tenderlove | ||||
* | Replace map.flatten with flat_map in activerecord | Erik Michaels-Ober | 2014-03-03 | 1 | -1/+1 |
| | |||||
* | 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 initialize method | Aaron Patterson | 2013-09-25 | 1 | -4/+0 |
| | |||||
* | extract association resetting to a method | Aaron Patterson | 2013-09-25 | 1 | -9/+16 |
| | |||||
* | always populate the preloaded records instance variable so we can remove | Aaron Patterson | 2013-09-25 | 1 | -7/+4 |
| | | | | the @associated_records_by_owner ivar | ||||
* | keep preloaded records in a list rather than extract from a hash | Aaron Patterson | 2013-09-25 | 1 | -2/+8 |
| | |||||
* | 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 | 1 | -3/+1 |
| | |||||
* | push preloaded test up to the factory method so we can eliminate | Aaron Patterson | 2013-09-24 | 1 | -3/+3 |
| | | | | 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 | 1 | -8/+6 |
| | |||||
* | 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 | 1 | -7/+11 |
| | |||||
* | hm:t preloading will respect order set on the RHS association | Aaron Patterson | 2013-09-23 | 1 | -2/+25 |
| | |||||
* | 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 |
| |