aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/relations_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Return false for exists? with new records - fixes #6199.Andrew White2012-05-101-0/+1
| | | | (cherry picked from commit fa21b73ebb8339ad388f149c817c433b6254d490)
* Fix #4979 against 3-2-stable - delete_all raise an error if a limit is providedFrancesco Rodriguez2012-05-021-0/+4
|
* Add order to tests that rely on db ordering, to fix failing tests on pgCarlos Antonio da Silva2012-03-221-1/+1
| | | | | | | Also skip persistente tests related to UPDATE + ORDER BY for postgresql PostgreSQL does not support updates with order by, and these tests are failing randomly depending on the fixture loading order now.
* Add dynamic find_or_create_by_{attribute}! method.Andrew White2012-03-121-0/+12
| | | | | | | | | (cherry picked from commit 5282485d310d1a6ffcf55e4e7f56ab234e16880d) Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/dynamic_finder_match.rb
* Add ActiveRecord::Relation#uniq for toggling DISTINCT in the SQL queryJon Leighton2011-11-051-0/+16
|
* Rename first_or_new to first_or_initialize.Jon Leighton2011-09-131-12/+6
| | | | | For consistency with find_or_initialize_by. Also remove first_or_build alias.
* Not used variables removed. Warnings removed.Arun Agrawal2011-09-101-1/+1
|
* Merge pull request #2757 from andmej/first_or_create_pull_requestJon Leighton2011-09-081-0/+128
|\ | | | | Add first_or_create family of methods to Active Record
| * Adding first_or_create, first_or_create!, first_or_new and first_or_build to ↵Andrés Mejía2011-08-301-0/+128
| | | | | | | | | | | | | | | | | | | | Active Record. This let's you write things like: User.where(:first_name => "Scarlett").first_or_create!(:last_name => "Johansson", :hot => true) Related to #2420.
* | Revert "Fixes bug in ActiveRecord::QueryMethods, #1697"Jon Leighton2011-09-041-5/+0
| | | | | | | | | | | | This reverts commit 0df27c98d982ec87d2fb48cfda82694eb267993e. Reverted due to failing test, see #2845.
* | Fixes bug in ActiveRecord::QueryMethods, #1697Joshua Wehner2011-08-311-0/+5
| | | | | | Replace split on comma with a regexp that will reverse all ASC/DESC specifically
* | Ensure correct ordering of results in ↵Raimonds Simanovskis2011-08-301-1/+1
|/ | | | | | test_update_all_with_joins_and_offset_and_order Last two asserts in this test assume that all_comments are ordered by posts.id and then by comments.id therefore additional ordering is added. Without it test was failing on Oracle which returned results in different order.
* Fix PredicateBuilder clobbering select_values in subquery.Ernie Miller2011-08-201-0/+13
|
* Fix assumption of primary key name in PredicateBuilder subquery.Ernie Miller2011-08-201-0/+10
|
* Support for multi-table updates with limits, offsets and ordersJon Leighton2011-08-151-0/+30
|
* Support updates with joins. Fixes #522.Jon Leighton2011-08-151-0/+8
|
* Revert "Merge pull request #2309 from smasry/master"Jon Leighton2011-07-281-5/+0
| | | | | | | This reverts commit 9d396ee8195e31f646e0b89158ed96f4db4ab38f, reversing changes made to fa2bfd832c1d1e997d93c2269a485cc74782c86d. Reason: the change broke the build.
* Reverse order fix when using function for ActiveRecord::QueryMethods Fixes #1697Samer Masry2011-07-271-0/+5
|
* Simplify the test by using id and name. `id` will be the only real sort ↵Franck Verrot2011-07-261-1/+1
| | | | criteria in any case as it's unique.
* Ordering with extra spaces was raising a SQL exceptionFranck Verrot2011-07-241-0/+4
|
* Merge pull request #1273 from jeremyf/feature-association-proxy-sendSantiago Pastorino2011-07-061-0/+9
|\ | | | | Addresses an inconsistency in the ActiveRecord::Base.method_missing handl
| * Addresses an inconsistency in the ActiveRecord::Base.method_missing handling ↵Jeremy Friesen2011-05-241-0/+9
| | | | | | | | of dynamic finder methods and the passing of the &block parameter for :find_by_attributes.
* | Fix test_finding_with_cross_table_order_and_limit for OracleRaimonds Simanovskis2011-06-281-3/+3
| | | | | | Use latest Arel syntax and pass each order by expression as separate argument to order method as otherwise invalid Oracle SQL is generated.
* | Improve ordering of multiple columns on postgresqlLucia Escanellas2011-06-241-0/+7
| | | | | | | | | | * Only on postgresql, order("first asc, second asc") was invalid * Closes #1720
* | Support reversal of ARel orderings in reverse_sql_orderErnie Miller2011-06-201-0/+12
| |
* | 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.
* Merge branch 'master' into zomgAaron Patterson2011-03-291-0/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (51 commits) order is not guaranteed by this select, so add an order and call first! oracle stores this with microseconds, so convert to seconds before comparing make sure that active connections are not cleared during test when an exception happens clearing active connections in the ConnectionManagement middleware if an exception happens proxy body responses so we close database connections after body is flushed Pass the proper method_name instead of hardcoding to action_name. Quote find_in_batches ORDER BY clause [#6620 state:resolved] Delegate first!, last!, any? and many? to scoped Dont call authenticate_or_request_with_http_basic twice Remove 'warning: ambiguous first argument' when running ActionPack tests Change exists? so that it doesn't instantiate records [#6127 state:resolved] Move mapper_test to the appropriate location Update the wildcard route to be non-greedy by default, therefore be able to match the (.:format) segment [#6605 state:resolved] Fix examples Added Base.http_basic_authenticate_with to do simple http basic authentication with a single class method call [DHH] make sure we have an active database connection before running each connection management test adding active_connections? to the connection pool for finding open connections adding active_connection? to the connection pool testing app delegation from the ConnectionManagement middleware namespacing connection management tests. :heart: ...
| * Bring #reorder backSebastian Martinez2011-03-281-0/+6
| | | | | | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* | Use Arel to build subquery. Adapt tests to changed fixtures.John Mileham2011-03-241-3/+3
| |
* | Merge branch 'master' of github.com:rails/rails into count_behaviorJohn Mileham2011-03-241-20/+69
|\|
| * Merge branch 'master' into fuuuAaron Patterson2011-03-221-0/+8
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: Do not show optional (.:format) block for wildcard route [#6605 state:resolved] pushing id insertion and prefetch primary keys down to Relation#insert use prepared statements to fetch the last insert id escaping binary data encoding when inserting to sqlite3. Thanks Naruse! [#6559 state:resolved] schemas set by set_table_name are respected by the mysql adapter. [#5322 state:resolved] Reapply extensions when using except and only SJIS is an alias to Windows-31J in ruby trunk. Use SHIFT_JIS for this test Improved resolver docs a bit [action_view] docs for FileSystemResolver [action_view] added custom patterns to template resolver
| | * Reapply extensions when using except and onlyIain Hecker2011-03-211-0/+8
| | |
| * | Add order clauses to fix some tests which were failing under 1.8 on oracle ↵Jon Leighton2011-03-181-5/+5
| | | | | | | | | | | | and postgres
| * | Merge branch 'master' into nested_has_many_throughJon Leighton2011-03-161-0/+26
| |\|
| | * Remove invalid testAndrew White2011-03-131-5/+1
| | | | | | | | | | | | | | | The test fails on PostgreSQL when trying to load the records as the comments_count field is not included in the GROUP BY clause.
| | * Fixed a bug when empty? was called on a grouped Relation that wasn't loadedChris Oliver2011-03-121-0/+30
| | | | | | | | | | | | | | | | | | [#5829 state:resolved] Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
| | * Referencing a table via the ON condition in a join should force that table ↵Jon Leighton2011-03-071-0/+15
| | | | | | | | | | | | to be eager-loaded via a JOIN rather than via subsequent queries.
| * | Referencing a table via the ON condition in a join should force that table ↵Jon Leighton2011-03-071-0/+15
| | | | | | | | | | | | to be eager-loaded via a JOIN rather than via subsequent queries.
| * | Merge branch 'master' into nested_has_many_throughJon Leighton2011-03-041-24/+86
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | Merge branch 'master' into nested_has_many_throughJon Leighton2010-11-271-1/+29
| |\ \ | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/associations.rb
| * \ \ Merge branch 'master' into nested_has_many_throughJon Leighton2010-11-171-5/+30
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/lib/active_record/associations/has_many_through_association.rb activerecord/test/cases/associations/has_many_through_associations_test.rb
| * \ \ \ Merge branch 'master' into nested_has_many_throughJon Leighton2010-11-081-1/+12
| |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/lib/active_record/associations.rb
| * \ \ \ \ Merge branch 'master' into nested_has_many_throughJon Leighton2010-10-311-0/+5
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/lib/active_record/associations/has_many_association.rb activerecord/lib/active_record/associations/through_association_scope.rb
| * \ \ \ \ \ Merge branch 'master' into nested_has_many_throughJon Leighton2010-10-281-7/+9
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb activerecord/test/schema/schema.rb
| * | | | | | | Add explicit ordering in relations_test.rb, as the lack of this was causing ↵Jon Leighton2010-10-191-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | failures against postgres
| * | | | | | | Properly support conditions on any of the reflections involved in a nested ↵Jon Leighton2010-10-191-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | through association
| * | | | | | | Merge branch 'master' into nested_has_many_throughJon Leighton2010-10-141-6/+0
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/lib/active_record/associations.rb activerecord/test/cases/associations/cascaded_eager_loading_test.rb
| * | | | | | | | Fix the tests (I have actually verified that these are also the 'right' ↵Jon Leighton2010-10-031-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fixes, rather than just making the tests pass again)
* | | | | | | | | Change behavior of count(:limit => x, :offset => y) to limit/offset before ↵John Mileham2011-03-031-0/+28
| |_|_|_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | counting.