Commit message (Collapse) | Author | Age | Files | Lines | ||
---|---|---|---|---|---|---|
... | ||||||
* | | Load all records in Relation#inspect | Jon Leighton | 2012-07-07 | 1 | -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 Leighton | 2012-07-07 | 1 | -1/+4 | |
| | | | | | | | | relation | |||||
* | | Simplify Relation#inspect | Jon Leighton | 2012-07-07 | 1 | -12/+3 | |
| | | ||||||
* | | Limit the number of records in Relation#inspect | Damien Mathieu | 2012-07-06 | 1 | -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#inspect | Jon Leighton | 2012-07-06 | 1 | -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#inspect | Brian Cardarella | 2012-06-29 | 1 | -4/+0 | |
| | | ||||||
* | | Refactor Relation#update a bit to avoid an extra Enumerator instance | Carlos Antonio da Silva | 2012-06-18 | 1 | -1/+1 | |
|/ | ||||||
* | add explanation of raising errors when a limit scope is supplied in ↵ | Francesco Rodriguez | 2012-05-18 | 1 | -11/+11 | |
| | | | | Relation#delete_all | |||||
* | delete_all raise an error if a limit is provided - fixes #4979 | Francesco Rodriguez | 2012-04-30 | 1 | -0/+2 | |
| | ||||||
* | extract #with_scope and #with_exclusive_scope to ↵ | Jon Leighton | 2012-04-25 | 1 | -1/+4 | |
| | | | | active_record_deprecated_finders | |||||
* | move some of the update_all implementation to active_record_deprecated_finders | Jon Leighton | 2012-04-13 | 1 | -27/+14 | |
| | ||||||
* | now we can just manipulate the values hash in #only and #except | Jon Leighton | 2012-04-13 | 1 | -4/+8 | |
| | ||||||
* | use a hash to store relation values | Jon Leighton | 2012-04-13 | 1 | -15/+12 | |
| | ||||||
* | Make Relation#extending work like other value methods | Jon Leighton | 2012-04-13 | 1 | -3/+4 | |
| | ||||||
* | assert valid keys | Jon Leighton | 2012-04-13 | 1 | -0/+2 | |
| | ||||||
* | Allow Relation#merge to take a hash | Jon Leighton | 2012-04-13 | 1 | -1/+1 | |
| | ||||||
* | we have no need for the ASSOCIATION_METHODS constant | Jon Leighton | 2012-04-13 | 1 | -4/+7 | |
| | ||||||
* | Fix delete_all when chained with joins. | Rafael Mendonça França | 2012-04-10 | 1 | -2/+10 | |
| | | | | Closes #5202 and #919 | |||||
* | Correct description of ['migrated_at > ?', 1.week.ago] from "more than a ↵ | Dave Burt | 2012-03-20 | 1 | -1/+1 | |
| | | | | week ago" to "more recently than a week ago." | |||||
* | relation .present? and .blank? should not query SELECT COUNT(DISTINCT id) | Thiago Almeida | 2012-03-16 | 1 | -0/+4 | |
| | ||||||
* | Remove IdentityMap | Carlos Antonio da Silva | 2012-03-13 | 1 | -10/+1 | |
| | ||||||
* | use bind values for join columns | Aaron Patterson | 2012-02-27 | 1 | -1/+6 | |
| | ||||||
* | prepared statements can be disabled | Aaron Patterson | 2012-02-21 | 1 | -1/+2 | |
| | ||||||
* | let AR::Relation pretty_printed like an Array | Akira Matsuda | 2012-01-21 | 1 | -0/+4 | |
| | ||||||
* | Deprecate inferred JOINs with includes + SQL snippets. | Jon Leighton | 2012-01-16 | 1 | -3/+25 | |
| | | | | | | See the CHANGELOG for details. Fixes #950. | |||||
* | store references as a string | Jon Leighton | 2012-01-16 | 1 | -1/+1 | |
| | ||||||
* | Make referencing an included item trigger eager loading | Jon Leighton | 2012-01-16 | 1 | -1/+2 | |
| | ||||||
* | Add ActiveRecord::Relation#references (#950) | Jon Leighton | 2012-01-16 | 1 | -1/+1 | |
| | ||||||
* | Revert "Deprecate implicit eager loading. Closes #950." | Jon Leighton | 2012-01-16 | 1 | -13/+1 | |
| | | | | This reverts commit c99d507fccca2e9e4d12e49b4387e007c5481ae9. | |||||
* | correctly handle order calls after a reorder | Matt Jones + Scott Walker | 2012-01-03 | 1 | -1/+1 | |
| | ||||||
* | Merge branch 'master' of github.com:lifo/docrails | Vijay Dev | 2011-12-29 | 1 | -1/+1 | |
|\ | ||||||
| * | typo | Jo Liss | 2011-12-28 | 1 | -1/+1 | |
| | | ||||||
* | | Deprecate implicit eager loading. Closes #950. | Jon Leighton | 2011-12-29 | 1 | -1/+13 | |
|/ | ||||||
* | AS::Concern is not really needed for AR::Explain | Xavier Noria | 2011-12-16 | 1 | -1/+1 | |
| | ||||||
* | Split out most of the AR::Base code into separate modules :cake: | Jon Leighton | 2011-12-15 | 1 | -1/+1 | |
| | ||||||
* | Set up delegations also for to_a and arel branches. | José Valim | 2011-12-15 | 1 | -7/+0 | |
| | ||||||
* | Move delegation reponsibilities of Relation to a module. Also precompile ↵ | José Valim | 2011-12-15 | 1 | -22/+1 | |
| | | | | method missing calls for rofscale. | |||||
* | Make with_scope public so we stop using send :bomb: | José Valim | 2011-12-15 | 1 | -1/+1 | |
| | ||||||
* | Improve delegate list to avoid method missing. | José Valim | 2011-12-15 | 1 | -1/+2 | |
| | ||||||
* | There isn't a column_hash. It was being invoked by method missing. | José Valim | 2011-12-15 | 1 | -1/+1 | |
| | ||||||
* | implements a much faster auto EXPLAIN, closes #3843 [José Valim & Xavier Noria] | Xavier Noria | 2011-12-04 | 1 | -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 warning | Arun Agrawal | 2011-12-02 | 1 | -1/+1 | |
| | ||||||
* | revises some details in the previous explain patch | Xavier Noria | 2011-12-02 | 1 | -1/+1 | |
| | ||||||
* | implements automatic EXPLAIN logging for slow queries | Xavier Noria | 2011-12-02 | 1 | -16/+29 | |
| | ||||||
* | add the query to AR::Relation#explain output | Xavier Noria | 2011-11-25 | 1 | -2/+3 | |
| | | | | | | | Rationale: this is more readable if serveral queries are involved in one call. Also, it will be possible to let AR log EXPLAINs automatically in production mode, where queries are not even around. | |||||
* | implements AR::Relation#explain | Xavier Noria | 2011-11-05 | 1 | -0/+16 | |
| | | | | | | | | | | | | | | | | | | | This is a first implementation, EXPLAIN is highly dependent on the database and I have made some compromises. On one hand, the method allows you to run the most common EXPLAIN and that's it. If you want EXPLAIN ANALYZE in PostgreSQL you need to do it by hand. On the other hand, I've tried to construct a string as close as possible to the ones built by the respective shells. The rationale is that IMO the user should feel at home with the output and recognize it at first sight. Per database. I don't know whether this implementation is going to work well. Let's see whether people like it. | |||||
* | Add ActiveRecord::Relation#uniq for toggling DISTINCT in the SQL query | Jon Leighton | 2011-11-05 | 1 | -1/+1 | |
| | ||||||
* | Revert "Raise error on unknown primary key." | Jon Leighton | 2011-10-05 | 1 | -3/+3 | |
| | | | | This reverts commit ee2be435b1e5c0e94a4ee93a1a310e0471a77d07. | |||||
* | Raise error on unknown primary key. | Jon Leighton | 2011-10-05 | 1 | -3/+3 | |
| | | | | | If we don't have a primary key when we ask for it, it's better to fail fast. Fixes GH #2307. | |||||
* | Rename first_or_new to first_or_initialize. | Jon Leighton | 2011-09-13 | 1 | -2/+1 | |
| | | | | | For consistency with find_or_initialize_by. Also remove first_or_build alias. |