aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/preloader/association.rb
Commit message (Collapse)AuthorAgeFilesLines
* hash insertion order doesn't matter anymore, so only loop over theAaron Patterson2013-09-251-4/+2
| | | | owners once
* keep preloaded records in a list rather than extract from a hashAaron Patterson2013-09-251-13/+9
|
* push slice loading to it's own method so we can remove the type castingAaron Patterson2013-09-241-13/+8
| | | | code
* guarantee that `klass` is not nil inside the preloader objectsAaron Patterson2013-09-241-1/+1
|
* eliminate the `loaded?` conditionalAaron Patterson2013-09-241-7/+0
|
* push preloaded test up to the factory method so we can eliminateAaron Patterson2013-09-241-3/+1
| | | | conditionals from the individual preloaded classes
* pass the preloader down so we only have to construct oneAaron Patterson2013-09-231-5/+5
|
* fix variable names and speed up relation orderingAaron Patterson2013-09-231-9/+1
|
* hm:t preloading will respect order set on the RHS associationAaron Patterson2013-09-231-2/+22
|
* cache associated target records hashAaron Patterson2013-09-201-17/+11
|
* preserve order on the RHS queryAaron Patterson2013-09-201-0/+8
|
* push `run` up to preloadAaron Patterson2013-09-201-3/+7
|
* exposing target records on the preloaderAaron Patterson2013-09-201-14/+27
|
* correctly typecast keys, remove conditionals, reduce object allocationsAaron Patterson2013-08-281-7/+6
|
* no need to to_a the scopeAaron Patterson2013-08-281-1/+1
|
* remove extra flat_map arrayAaron Patterson2013-08-281-8/+9
|
* avoid extra empty array allocationAaron Patterson2013-08-281-10/+10
|
* extract owner id calculation to a methodAaron Patterson2013-08-281-1/+5
|
* only call to_a when we have toAaron Patterson2013-08-281-1/+5
|
* use flat_mapNeeraj Singh2013-08-031-1/+1
|
* Simplify/fix implementation of default scopesJon Leighton2013-06-281-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.
* Eager loading made to use relation's in_clause_length instead of host's one ↵Boris Staal2012-12-201-1/+1
| | | | (fixes #8474)
* Revert "Use flat_map { } instead of map {}.flatten"Santiago Pastorino2012-10-051-1/+1
| | | | | | | | | | | This reverts commit abf8de85519141496a6773310964ec03f6106f3f. We should take a deeper look to those cases flat_map doesn't do deep flattening. irb(main):002:0> [[[1,3], [1,2]]].map{|i| i}.flatten => [1, 3, 1, 2] irb(main):003:0> [[[1,3], [1,2]]].flat_map{|i| i} => [[1, 3], [1, 2]]
* Use flat_map { } instead of map {}.flattenSantiago Pastorino2012-10-051-1/+1
|
* s/scoped/scope/Jon Leighton2012-08-011-4/+4
|
* Convert association macros to the new syntaxJon Leighton2012-07-201-1/+1
|
* Represent association scope options as AR::Relations insternally.Jon Leighton2012-07-131-27/+22
|
* Fix #5667. Preloading should ignore scoping.Jon Leighton2012-03-301-2/+3
|
* Avoid sanitize_sql when we can use Relation#where insteadJon Leighton2012-01-161-8/+6
|
* Revert "Deprecate implicit eager loading. Closes #950."Jon Leighton2012-01-161-1/+0
| | | | This reverts commit c99d507fccca2e9e4d12e49b4387e007c5481ae9.
* Deprecate implicit eager loading. Closes #950.Jon Leighton2011-12-291-0/+1
|
* reduce calls to owners_by_key and to read_attribute, respond_to? etcAaron Patterson2011-07-011-2/+3
|
* Rewrote AssociationPreload.Jon Leighton2011-02-281-0/+126