aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation.rb
Commit message (Collapse)AuthorAgeFilesLines
* Refactor a bitJon Leighton2012-08-011-38/+37
| | | | | This doesn't change the exernal behavior, but it moves some code around to where I think it properly belongs.
* Add `Relation#load`Jon Leighton2012-08-011-2/+12
| | | | | | | | | | | | | 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
* minor copy edits [ci skip]Vijay Dev2012-07-211-3/+1
|
* Fix typosOscar Del Ben2012-07-191-3/+3
|
* Fix typos and add nodocs to NullRelationOscar Del Ben2012-07-171-3/+3
|
* Improve docs for AR RelationOscar Del Ben2012-07-171-7/+19
|
* Add docs for Relation initialize, create and create!Oscar Del Ben2012-07-161-1/+34
|
* Don't link to edgeguides in docsOscar Del Ben2012-07-161-1/+1
|
* Load all records in Relation#inspectJon Leighton2012-07-071-4/+1
| | | | | | | | | | | | | | | | | | | A test was failing due to the way that Relation#inspect causes association proxies to ignore unsaved records added to the association. This is fixed by simply calling to_a and letting to_a figure out how to get the records (which, in the case of associations, takes into account new records). I think it is acceptable to do this rather than limiting the query at the database level: * It's what we've done in all released Rails versions up to this point * The goal of the limit is to not flood the console with output - this is the problem we're targeting, rather than the actual loading of the records from the database * You probably want to do something with those records later anyway, otherwise you wouldn't have built a relation for them.
* Relation#inspect handles doesn't perform a new query on an already-loaded ↵Jon Leighton2012-07-071-1/+4
| | | | relation
* Simplify Relation#inspectJon Leighton2012-07-071-12/+3
|
* Limit the number of records in Relation#inspectDamien Mathieu2012-07-061-1/+13
| | | | 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/+4
| | | | | | | | | | | | | | | | | 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.
* Remove ActiveRelation#inspectBrian Cardarella2012-06-291-4/+0
|
* Refactor Relation#update a bit to avoid an extra Enumerator instanceCarlos Antonio da Silva2012-06-181-1/+1
|
* add explanation of raising errors when a limit scope is supplied in ↵Francesco Rodriguez2012-05-181-11/+11
| | | | Relation#delete_all
* delete_all raise an error if a limit is provided - fixes #4979Francesco Rodriguez2012-04-301-0/+2
|
* extract #with_scope and #with_exclusive_scope to ↵Jon Leighton2012-04-251-1/+4
| | | | active_record_deprecated_finders
* move some of the update_all implementation to active_record_deprecated_findersJon Leighton2012-04-131-27/+14
|
* now we can just manipulate the values hash in #only and #exceptJon Leighton2012-04-131-4/+8
|
* use a hash to store relation valuesJon Leighton2012-04-131-15/+12
|
* Make Relation#extending work like other value methodsJon Leighton2012-04-131-3/+4
|
* assert valid keysJon Leighton2012-04-131-0/+2
|
* Allow Relation#merge to take a hashJon Leighton2012-04-131-1/+1
|
* we have no need for the ASSOCIATION_METHODS constantJon Leighton2012-04-131-4/+7
|
* Fix delete_all when chained with joins.Rafael Mendonça França2012-04-101-2/+10
| | | | Closes #5202 and #919
* Correct description of ['migrated_at > ?', 1.week.ago] from "more than a ↵Dave Burt2012-03-201-1/+1
| | | | week ago" to "more recently than a week ago."
* relation .present? and .blank? should not query SELECT COUNT(DISTINCT id)Thiago Almeida2012-03-161-0/+4
|
* Remove IdentityMapCarlos Antonio da Silva2012-03-131-10/+1
|
* use bind values for join columnsAaron Patterson2012-02-271-1/+6
|
* prepared statements can be disabledAaron Patterson2012-02-211-1/+2
|
* let AR::Relation pretty_printed like an ArrayAkira Matsuda2012-01-211-0/+4
|
* Deprecate inferred JOINs with includes + SQL snippets.Jon Leighton2012-01-161-3/+25
| | | | | | See the CHANGELOG for details. Fixes #950.
* store references as a stringJon Leighton2012-01-161-1/+1
|
* Make referencing an included item trigger eager loadingJon Leighton2012-01-161-1/+2
|
* Add ActiveRecord::Relation#references (#950)Jon Leighton2012-01-161-1/+1
|
* Revert "Deprecate implicit eager loading. Closes #950."Jon Leighton2012-01-161-13/+1
| | | | This reverts commit c99d507fccca2e9e4d12e49b4387e007c5481ae9.
* correctly handle order calls after a reorderMatt Jones + Scott Walker2012-01-031-1/+1
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2011-12-291-1/+1
|\
| * typoJo Liss2011-12-281-1/+1
| |
* | Deprecate implicit eager loading. Closes #950.Jon Leighton2011-12-291-1/+13
|/
* AS::Concern is not really needed for AR::ExplainXavier Noria2011-12-161-1/+1
|
* Split out most of the AR::Base code into separate modules :cake:Jon Leighton2011-12-151-1/+1
|
* Set up delegations also for to_a and arel branches.José Valim2011-12-151-7/+0
|
* Move delegation reponsibilities of Relation to a module. Also precompile ↵José Valim2011-12-151-22/+1
| | | | method missing calls for rofscale.
* Make with_scope public so we stop using send :bomb:José Valim2011-12-151-1/+1
|
* Improve delegate list to avoid method missing.José Valim2011-12-151-1/+2
|
* There isn't a column_hash. It was being invoked by method missing.José Valim2011-12-151-1/+1
|
* implements a much faster auto EXPLAIN, closes #3843 [José Valim & Xavier Noria]Xavier Noria2011-12-041-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | This commit vastly reduces the impact of auto explain logging when enabled, while keeping a negligible cost when disabled. The first implementation was based on the idea of subscribing to "sql.active_record" when needed, and unsubscribing once done. This is the idea behind AR::Relation#explain. Subscribe, collect, unsubscribe. But with the current implementation of notifications unsubscribing is costly, because it wipes an internal cache and that puts a penalty on the next event. So we are switching to an approach where a long-running subscriber is listening. Instead of collecting the queries with a closure in a dedicated subscriber, now we setup a thread local. If the feature is disabled by setting the threshold to nil, the subscriber will call a method that does nothing. That's totally cheap.
* indentation fix warningArun Agrawal2011-12-021-1/+1
|