aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/relations_test.rb
Commit message (Collapse)AuthorAgeFilesLines
...
| * raise ArgumentError if list of attributes to change is empty in update_allRoman Shatsov2012-08-141-0/+4
| |
* | Remove ActiveRecord::Base.to_aJon Leighton2012-08-031-1/+1
| | | | | | | | | | 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.
* | Add `Relation#load`Jon Leighton2012-08-011-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | This method explicitly loads the records and then returns `self`. Rather than deciding between "do I want an array or a relation?", most people are actually asking themselves "do I want to eager load or lazy load?" Therefore, this method provides a way to explicitly eager-load without having to switch from a `Relation` to an array. Example: @posts = Post.where(published: true).load
* | AR::Relation#order: make new order prepend old oneBogdan Gusiev2012-07-311-5/+5
| | | | | | | | | | | | | | 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-58/+58
| | | | | | | | | | | | | | 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-24/+24
|/ | | | | | | | | | | 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.
* support relations created with a table aliasJon Leighton2012-07-131-0/+10
|
* Relation#inspect handles doesn't perform a new query on an already-loaded ↵Jon Leighton2012-07-071-1/+12
| | | | relation
* Limit the number of records in Relation#inspectDamien Mathieu2012-07-061-0/+5
| | | | While it's interesting to have the results array, it can make a console or a webpage freeze if there are a lot of them. So this limits the number of records displayed in #inspect to 10 and tells how much were effectively found.
* Show the records in Relation#inspectJon Leighton2012-07-061-0/+5
| | | | | | | | | | | | | | | | | The reason for removing the previous implementation of `#inspect` was that it hid from you that you were dealing with a `Relation` rather than an `Array`. But it is still useful to be able to see the records, particularly if you're writing something like the following in tests: assert_equal [foo], Post.where(:bar) If the assertion fails, you want to see what records were actually loaded. So this implementation makes it clear that you've got a `Relation`, but also shows your records.
* disallow mutating a relation once loadedJon Leighton2012-06-221-0/+27
|
* a test case that ensures AR::Relation#merge can merge associationsAkira Matsuda2012-06-031-0/+8
|
* modulize AR::NullRelationAkira Matsuda2012-06-011-1/+6
| | | | now we can invoke previously added scope extension methods
* fixed typo in word finidingIvan Kukobko2012-05-201-1/+1
|
* quarantine more deprecated stuffJon Leighton2012-05-181-9/+0
|
* quarantine deprecated testsJon Leighton2012-05-181-43/+3
|
* Relation#from to accept other Relation objectsRadoslav Stankov2012-05-171-0/+7
| | | | Record.from("(#{sub_query.to_sql})") -> Record.from(sub_query) Record.from("(#{sub_query.to_sql}) a") -> Record.from(sub_query, :a)
* Return false for exists? with new records - fixes #6199.Andrew White2012-05-101-0/+1
|
* Use `take` instead of `first` to avoid unwanted implicit ordering (fixes #6147)Marcelo Silveira2012-05-051-1/+9
|
* delete_all raise an error if a limit is provided - fixes #4979Francesco Rodriguez2012-04-301-0/+4
|
* find and replace deprecated keysJon Leighton2012-04-271-1/+1
|
* %s/find(:\(first\|last\|all\), \([^()]*\))/scoped(\2).\1/gcI amongst other ↵Jon Leighton2012-04-271-8/+3
| | | | things
* remove deprecate #all usageJon Leighton2012-04-261-4/+0
|
* remove deprecated scope stuffJon Leighton2012-04-261-13/+0
|
* remove tests for #with_scope (it's now deprecated)Jon Leighton2012-04-251-1/+0
|
* Override AR::Relation methods in NullRelation.Juanjo Bazán2012-04-111-0/+33
| | | So a NullRelation (Relation#none) is chainable with database methods.
* Add Relation#find_by and Relation#find_by!Jon Leighton2012-03-301-0/+34
|
* Fix typo in ActiveRecord::Relation#blank? testRuben Davila2012-03-171-1/+1
|
* Fix ActiveRecord::Relation#blank? testsRafael Mendonça França2012-03-161-12/+15
|
* test relation presence fixThiago Almeida2012-03-161-4/+4
|
* tests for Relation .present? and .blank? are check cases and shouldn't force ↵Thiago Almeida2012-03-161-0/+19
| | | | sql-count
* Remove IdentityMapCarlos Antonio da Silva2012-03-131-9/+7
|
* Add dynamic find_or_create_by_{attribute}! method.Andrew White2012-03-121-0/+12
|
* fix build #5001 reply model required in relations_testVishnu Atrai2012-02-121-0/+1
|
* removed unuseful require for reply as we are not using require modelKarunakar (Ruby)2012-02-111-1/+0
|
* Added `none` query method to return zero records.Juanjo Bazán2012-01-311-0/+13
| | | And added NullRelation class implementing the null object pattern for the `Relation` class.
* Deprecate inferred JOINs with includes + SQL snippets.Jon Leighton2012-01-161-3/+5
| | | | | | See the CHANGELOG for details. Fixes #950.
* infer references from Relation#orderJon Leighton2012-01-161-1/+21
|
* store references as a stringJon Leighton2012-01-161-4/+4
|
* automatically add references when we canJon Leighton2012-01-161-0/+14
|
* Make referencing an included item trigger eager loadingJon Leighton2012-01-161-0/+11
|
* Revert "Deprecate implicit eager loading. Closes #950."Jon Leighton2012-01-161-21/+5
| | | | This reverts commit c99d507fccca2e9e4d12e49b4387e007c5481ae9.
* Deprecate implicit eager loading. Closes #950.Jon Leighton2011-12-291-5/+21
|
* 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