Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | where needs to bring the bind params when creating a new relation | Aaron Patterson | 2014-01-14 | 1 | -0/+3 |
| | |||||
* | add a specific factory method rather than using new | Aaron Patterson | 2013-07-23 | 1 | -1/+1 |
| | |||||
* | Simplify/fix implementation of default scopes | Jon Leighton | 2013-06-28 | 1 | -1/+0 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. | ||||
* | refatctoring of some code repetition in spawn_methods | Angelo capilleri | 2012-12-31 | 1 | -8/+10 |
| | |||||
* | remove unneeded Examples tag [ci skip] | Carlos Duclos | 2012-12-01 | 1 | -10/+0 |
| | |||||
* | Mark Relation mutators as :nodoc: | Jon Leighton | 2012-11-30 | 1 | -2/+1 |
| | | | | | These are for internal use only and cannot be relied on as part of the public API. See discussion on 8c2c60511beaad05a218e73c4918ab89fb1804f0. | ||||
* | 1.9 Syntax related changes | AvnerCohen | 2012-11-10 | 1 | -2/+2 |
| | |||||
* | Allow Relation#merge to take a proc. | Jon Leighton | 2012-08-03 | 1 | -2/+13 |
| | | | | | | | | | | | | | | | | | | This was requested by DHH to allow creating of one's own custom association macros. For example: module Commentable def has_many_comments(extra) has_many :comments, -> { where(:foo).merge(extra) } end end class Post < ActiveRecord::Base extend Commentable has_many_comments -> { where(:bar) } end | ||||
* | load active_support/core_ext/object/blank in active_support/rails | Xavier Noria | 2012-08-02 | 1 | -1/+0 |
| | |||||
* | Add nodocs to delegation module and docs for merge! | Oscar Del Ben | 2012-07-17 | 1 | -0/+1 |
| | |||||
* | CollectionProxy < Relation | Jon Leighton | 2012-05-11 | 1 | -4/+9 |
| | | | | | | | | | | | | | | | | | | | | | This helps bring the interfaces of CollectionProxy and Relation closer together, and reduces the delegation backflips we need to perform. For example, first_or_create is defined thus: class ActiveRecord::Relation def first_or_create(...) first || create(...) end end If CollectionProxy < Relation, then post.comments.first_or_create will hit the association's #create method which will actually add the new record to the association, just as post.comments.create would. With the previous delegation, post.comments.first_or_create expands to post.comments.scoped.first_or_create, where post.comments.scoped has no knowledge of the association. | ||||
* | SpawnMethods#merge returns the intersection when passed an array, and not ↵ | Mitch Crowe | 2012-05-05 | 1 | -2/+2 |
| | | | | the union. Update the documentation to reflect this. | ||||
* | fix interpolation for hash merging | Jon Leighton | 2012-04-25 | 1 | -5/+2 |
| | |||||
* | Add documentation to the SpawnMethods#merge method. | Mitch Crowe | 2012-04-17 | 1 | -0/+14 |
| | |||||
* | now we can just manipulate the values hash in #only and #except | Jon Leighton | 2012-04-13 | 1 | -22/+4 |
| | |||||
* | Make Relation#extending work like other value methods | Jon Leighton | 2012-04-13 | 1 | -4/+2 |
| | |||||
* | Add Relation#merge! | Jon Leighton | 2012-04-13 | 1 | -9/+12 |
| | |||||
* | Allow Relation#merge to take a hash | Jon Leighton | 2012-04-13 | 1 | -2/+5 |
| | |||||
* | we have no need for the ASSOCIATION_METHODS constant | Jon Leighton | 2012-04-13 | 1 | -2/+2 |
| | |||||
* | Extract clusterfuck method for surgery | Jon Leighton | 2012-04-13 | 1 | -71/+8 |
| | |||||
* | move apply_finder_options to active_record_deprecated_finders | Jon Leighton | 2012-04-12 | 1 | -22/+0 |
| | |||||
* | use bind values for join columns | Aaron Patterson | 2012-02-27 | 1 | -1/+4 |
| | |||||
* | use regular ruby for fewer method calls. we do not need :gift:s! | Aaron Patterson | 2012-02-24 | 1 | -1/+4 |
| | |||||
* | Deprecate inferred JOINs with includes + SQL snippets. | Jon Leighton | 2012-01-16 | 1 | -2/+2 |
| | | | | | | See the CHANGELOG for details. Fixes #950. | ||||
* | Revert "Deprecate implicit eager loading. Closes #950." | Jon Leighton | 2012-01-16 | 1 | -2/+2 |
| | | | | This reverts commit c99d507fccca2e9e4d12e49b4387e007c5481ae9. | ||||
* | correctly handle order calls after a reorder | Matt Jones + Scott Walker | 2012-01-03 | 1 | -2/+11 |
| | |||||
* | Deprecate implicit eager loading. Closes #950. | Jon Leighton | 2011-12-29 | 1 | -2/+2 |
| | |||||
* | default create_with_value to a hash so we can eliminate conditionals, add ↵ | Aaron Patterson | 2011-06-27 | 1 | -1/+1 |
| | | | | test surrounding create_with(nil) behavior | ||||
* | Evaluate default scopes at the last possible moment in order to avoid ↵ | Jon Leighton | 2011-04-12 | 1 | -0/+4 |
| | | | | problems with default scopes getting included into other scopes and then being unable to remove the default part via unscoped. | ||||
* | Reapply extensions when using except and only | Iain Hecker | 2011-03-21 | 1 | -0/+6 |
| | |||||
* | Remove Relation#& alias for Relation#merge | Ernie Miller | 2011-02-12 | 1 | -2/+0 |
| | |||||
* | Merge branch 'master' of git://github.com/lifo/docrails | Xavier Noria | 2011-01-20 | 1 | -0/+14 |
|\ | |||||
| * | document ActiveRecord's except and only | Jordi Romero | 2011-01-15 | 1 | -0/+14 |
| | | | | | | | | Document methods that allow easily override arel queries | ||||
* | | Make Relation#create_with always merge rather than overwrite, not just when ↵ | Jon Leighton | 2011-01-03 | 1 | -3/+1 |
| | | | | | | | | merging two relations. If you wish to overwrite, you can do relation.create_with(nil), or for a specific attribute, relation.create_with(:attr => nil). | ||||
* | | Let AssociationCollection#find use #scoped to do its finding. Note that I am ↵ | Jon Leighton | 2011-01-03 | 1 | -1/+1 |
| | | | | | | | | removing test_polymorphic_has_many_going_through_join_model_with_disabled_include, since this specifies different behaviour for an association than for a regular scope. It seems reasonable to expect scopes and association proxies to behave in roughly the same way rather than having subtle differences. | ||||
* | | Specify the STI type condition using SQL IN rather than a whole load of ORs. ↵ | Jon Leighton | 2010-12-31 | 1 | -1/+5 |
|/ | | | | Required a fix to ActiveRecord::Relation#merge for properly merging create_with_value. This also fixes a situation where the type condition was appearing twice in the resultant SQL query. | ||||
* | making relationship merge cheaper | Aaron Patterson | 2010-11-30 | 1 | -3/+4 |
| | |||||
* | only returning where values for the corresponding relation, also filtering ↵ | Aaron Patterson | 2010-10-30 | 1 | -4/+5 |
| | | | | where value hash based on table name [#5234 state:resolved] [#5184 state:resolved] | ||||
* | no need to merge where values if no new where values have been added | Aaron Patterson | 2010-10-30 | 1 | -11/+13 |
| | |||||
* | reduce duplicate where removal to one loop | Aaron Patterson | 2010-10-20 | 1 | -15/+13 |
| | |||||
* | swap out some n^2 for some n | Aaron Patterson | 2010-10-19 | 1 | -7/+13 |
| | |||||
* | dup rather than create so many arrays | Aaron Patterson | 2010-10-19 | 1 | -2/+2 |
| | |||||
* | use array math rather than looping through the array | Aaron Patterson | 2010-10-19 | 1 | -1/+1 |
| | |||||
* | reorder removed in favor of except(:order).order | Santiago Pastorino | 2010-10-11 | 1 | -10/+1 |
| | |||||
* | intersection between a relation and an array works in both directions | Marcelo Giorgi | 2010-09-10 | 1 | -0/+1 |
| | | | | Signed-off-by: Mikel Lindsaar <raasdnil@gmail.com> | ||||
* | Refactor finder conditions look up and assigment for apply_finder_conditions. | Emilio Tagua | 2010-09-09 | 1 | -13/+7 |
| | |||||
* | Refactor Relation#only. No need to go through every option and test it. | Emilio Tagua | 2010-09-09 | 1 | -8/+6 |
| | |||||
* | No need to go through every option and test it, just don't add skipped ones. | Emilio Tagua | 2010-09-09 | 1 | -4/+4 |
| | |||||
* | Make scoped reorder override previous applied orders | Santiago Pastorino | 2010-09-05 | 1 | -1/+10 |
| | | | | [5528 state:committed] | ||||
* | order should always be concatenated. | Neeraj Singh | 2010-09-05 | 1 | -2/+1 |
| | | | | | | | | | | | | | | | | | | | | | | order that is declared first has highest priority in all cases. Here are some examples. Car.order('name desc').find(:first, :order => 'id').name Car.named_scope_with_order.named_scope_with_another_order Car.order('id DESC').scoping do Car.find(:first, :order => 'id asc') end No special treatment to with_scope or scoping. Also note that if default_scope declares an order then the order declared in default_scope has the highest priority unless with_exclusive_scope is used. Signed-off-by: Santiago Pastorino <santiago@wyeworks.com> |