aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/relation_scoping_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove ActiveRecord::Base.to_aJon Leighton2012-08-031-16/+16
| | | | | On reflection, it seems like a bit of a weird method to have on ActiveRecord::Base, and it shouldn't be needed most of the time anyway.
* AR::Relation#order: make new order prepend old oneBogdan Gusiev2012-07-311-4/+4
| | | | | | | User.order("name asc").order("created_at desc") # SELECT * FROM users ORDER BY created_at desc, name asc This also affects order defined in `default_scope` or any kind of associations.
* Deprecate ActiveRecord::Base.scoped.Jon Leighton2012-07-271-10/+10
| | | | | | | It doesn't serve much purpose now that ActiveRecord::Base.all returns a Relation. The code is moved to active_record_deprecated_finders.
* ActiveRecord::Base.all returns a Relation.Jon Leighton2012-07-271-23/+23
| | | | | | | | | | | Previously it returned an Array. If you want an array, call e.g. `Post.to_a` rather than `Post.all`. This is more explicit. In most cases this should not break existing code, since Relations use method_missing to delegate unknown methods to #to_a anyway.
* quarantine deprecated testsJon Leighton2012-05-181-13/+2
|
* Fix failing test on Oracle. Having a duplicated column specified in aMarcelo Silveira2012-05-071-1/+1
| | | | | | select with order on the same column makes Oracle complain about "column ambiguously defined" when an order is defined on such column (introduced by default order on `first`) (fixes #6147).
* %s/find(:\(first\|last\|all\), \([^()]*\))/scoped(\2).\1/gcI amongst other ↵Jon Leighton2012-04-271-4/+4
| | | | things
* remove calls to find(:first), find(:last) and find(:all)Jon Leighton2012-04-261-4/+4
|
* remove deprecated #first callsJon Leighton2012-04-261-2/+2
|
* remove tests for #with_scope (it's now deprecated)Jon Leighton2012-04-251-22/+0
|
* Deprecate inferred JOINs with includes + SQL snippets.Jon Leighton2012-01-161-1/+1
| | | | | | See the CHANGELOG for details. Fixes #950.
* Revert "Deprecate implicit eager loading. Closes #950."Jon Leighton2012-01-161-2/+2
| | | | This reverts commit c99d507fccca2e9e4d12e49b4387e007c5481ae9.
* Revert "Add return for 1.8.7"Carlos Antonio da Silva2012-01-061-1/+1
| | | | | | This reverts commit 665ef116ac9000d514c03fc61b216513f5cb7b25. There is no need for the return anymore, so reverting.
* correctly handle order calls after a reorderMatt Jones + Scott Walker2012-01-031-0/+6
|
* 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
| |