aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/relation_scoping_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Deprecate implicit eager loading. Closes #950.Jon Leighton2011-12-291-2/+2
|
* Add return for 1.8.7Jon Leighton2011-12-141-1/+1
|
* Fix default scope thread safety. Thanks @thedarkone for reporting.Jon Leighton2011-08-131-0/+18
|
* Make it the responsibility of the connection to hold onto an ARel visitor ↵Jon Leighton2011-08-081-1/+1
| | | | for generating SQL. This improves the code architecture generally, and solves some problems with marshalling. Adapter authors please take note: you now need to define an Adapter.visitor_for method, but it degrades gracefully with a deprecation warning for now.
* Add more test casesOriol Gual2011-06-281-0/+8
|
* Add failing testOriol Gual2011-06-281-0/+4
|
* default create_with_value to a hash so we can eliminate conditionals, add ↵Aaron Patterson2011-06-271-0/+7
| | | | test surrounding create_with(nil) behavior
* Apply the default scope earlier when doing calculations. Fixes #1682.Jon Leighton2011-06-231-0/+7
|
* please use ruby -I lib:test path/to/test.rb, or export RUBY_OPTAaron Patterson2011-06-061-1/+1
|
* Refactor Active Record test connection setup. Please see the ↵Jon Leighton2011-06-041-1/+1
| | | | RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
* Fix issue #1272Brian Mathiyakom2011-06-011-0/+15
| | | | | Set reverse_order_value when asked to reverse_order(). Do the actual reversal in build_arel.
* Ensure that calculations properly override the select value even if it's set ↵Jon Leighton2011-05-311-0/+5
| | | | in the default scope. Fixes #1395.
* Failing test for aggregating on default_scope with selectErik Fonselius2011-05-311-0/+4
|
* Fix infinite recursion where a lazy default scope references a scope. Fixes ↵Jon Leighton2011-05-251-0/+8
| | | | #1264.
* Ensure that ORDER BY clauses from default scopes are not included in ↵Jon Leighton2011-05-081-0/+4
| | | | calculation queries. Fixes #406.
* removed the default_scope deprecations and updated the docs and tests to ↵Josh Kalderimis2011-04-281-14/+6
| | | | reflect its use cases
* Bring back support for passing a callable object to the default_scope macro. ↵Jon Leighton2011-04-181-0/+12
| | | | You can also just use a block.
* Un-deprecate using 'default_scope' as a macro, but if you are calling the ↵Jon Leighton2011-04-181-164/+17
| | | | macro multiple times that will give deprecation warnings, and in 3.2 we will simply overwrite the default scope when you call the macro multiple times.
* Evaluate default scopes at the last possible moment in order to avoid ↵Jon Leighton2011-04-121-6/+11
| | | | problems with default scopes getting included into other scopes and then being unable to remove the default part via unscoped.
* Deprecated support for passing hashes and relations to default_scope, in ↵Jon Leighton2011-04-121-67/+164
| | | | favour of defining a 'default_scope' class method in the model. See the CHANGELOG for more details.
* Bring #reorder backSebastian Martinez2011-03-281-2/+2
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Merge branch 'master' into nested_has_many_throughJon Leighton2011-03-041-3/+21
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/class_methods/join_dependency.rb activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb activerecord/lib/active_record/associations/has_many_association.rb activerecord/lib/active_record/associations/has_many_through_association.rb activerecord/lib/active_record/associations/has_one_association.rb activerecord/lib/active_record/associations/has_one_through_association.rb activerecord/lib/active_record/associations/through_association_scope.rb activerecord/lib/active_record/reflection.rb activerecord/test/cases/associations/has_many_through_associations_test.rb activerecord/test/cases/associations/has_one_through_associations_test.rb activerecord/test/cases/reflection_test.rb activerecord/test/cases/relations_test.rb activerecord/test/fixtures/memberships.yml activerecord/test/models/categorization.rb activerecord/test/models/category.rb activerecord/test/models/member.rb activerecord/test/models/reference.rb activerecord/test/models/tagging.rb
| * Remove Relation#& alias for Relation#mergeErnie Miller2011-02-121-2/+2
| |
| * Construct an actual ActiveRecord::Relation object for the association scope, ↵Jon Leighton2011-01-071-1/+2
| | | | | | | | rather than a hash which is passed to apply_finder_options. This allows more flexibility in how the scope is created, for example because scope.where(a, b) and scope.where(a).where(b) mean different things.
| * Make Relation#create_with always merge rather than overwrite, not just when ↵Jon Leighton2011-01-031-0/+10
| | | | | | | | 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).
| * Specify the STI type condition using SQL IN rather than a whole load of ORs. ↵Jon Leighton2010-12-311-0/+7
| | | | | | | | 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.
| * stop calling deprecated apisAaron Patterson2010-12-261-1/+1
| |
| * Replace rudimentary named_scope with scope. [#6052 state:resolved]Pavel Gorbokon2010-12-151-1/+1
| | | | | | | | | | | | | | * rename method names (actually in tests) * rename instance variable @_named_scopes_cache to @_scopes_cache * rename references in doc comments * don't touch CHANGELOG :)
* | Merge branch 'master' into nested_has_many_throughJon Leighton2010-12-121-0/+16
|\| | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/associations/class_methods/join_dependency.rb activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb activerecord/lib/active_record/associations/has_many_through_association.rb
| * adding more tests surrounding where values hashAaron Patterson2010-11-291-0/+11
| |
| * testing attributes applied by default_scopeAaron Patterson2010-11-291-0/+5
| |
* | Merge branch 'master' into nested_has_many_throughJon Leighton2010-11-171-2/+0
|\| | | | | | | | | | | Conflicts: activerecord/lib/active_record/associations/has_many_through_association.rb activerecord/test/cases/associations/has_many_through_associations_test.rb
| * removing many unused variablesAaron Patterson2010-11-161-2/+0
| |
* | Merge branch 'master' into nested_has_many_throughJon Leighton2010-10-281-0/+46
|\| | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb activerecord/test/schema/schema.rb
| * default scope merge where clauses [#5488 state:resolved]Jan2010-10-201-0/+17
| |
| * default scope can accept any object that responds to #callAaron Patterson2010-10-191-0/+18
| |
| * Allow default_scope to accept a Proc.Tim Morgan2010-10-191-0/+11
|/
* reorder removed in favor of except(:order).orderSantiago Pastorino2010-10-111-8/+2
|
* Delegate ActiveRecord::Base.offset to scoped methods (analogous to limit) ↵Marcelo Giorgi2010-09-241-0/+6
| | | | | | [#5688 state:resolved] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* removing nonsensical tests, limit now actually adds a limitAaron Patterson2010-09-151-1/+1
|
* failing test for reorder overriding default_scopeNick Ragaz2010-09-051-0/+6
| | | | | | [5528] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* order should always be concatenated.Neeraj Singh2010-09-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | 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>
* Change relation merging to always append select, group and order valuesPratik Naik2010-08-311-6/+7
|
* code gardening: we have assert_(nil|blank|present), more concise, with ↵Xavier Noria2010-08-171-1/+1
| | | | better default failure messages - let's use them
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-2/+2
| | | | 's/[ \t]*$//' -i {} \;)
* Ensure default_scope can be overwriten by association conditions.José Valim2010-07-211-0/+5
|
* eagerly loaded association records should respect default_scope [#2931 ↵Subba Rao Pasupuleti2010-07-211-2/+16
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Added reorder delegation for ActiveRecord::Base(to be able to overwrite the ↵Vitalii Khustochka2010-07-131-0/+6
| | | | | | default_scope ordering in the named scope [#5093 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Add scoping and unscoped as the syntax to replace the old with_scope and ↵José Valim2010-06-291-0/+396
with_exclusive_scope. A few examples: * with_scope now should be scoping: Before: Comment.with_scope(:find => { :conditions => { :post_id => 1 } }) do Comment.first #=> SELECT * FROM comments WHERE post_id = 1 end After: Comment.where(:post_id => 1).scoping do Comment.first #=> SELECT * FROM comments WHERE post_id = 1 end * with_exclusive_scope now should be unscoped: class Post < ActiveRecord::Base default_scope :published => true end Post.all #=> SELECT * FROM posts WHERE published = true Before: Post.with_exclusive_scope do Post.all #=> SELECT * FROM posts end After: Post.unscoped do Post.all #=> SELECT * FROM posts end Notice you can also use unscoped without a block and it will return an anonymous scope with default_scope values: Post.unscoped.all #=> SELECT * FROM posts