aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation.rb
Commit message (Collapse)AuthorAgeFilesLines
* add the query to AR::Relation#explain outputXavier Noria2011-11-251-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#explainXavier Noria2011-11-051-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 queryJon Leighton2011-11-051-1/+1
|
* Revert "Raise error on unknown primary key."Jon Leighton2011-10-051-3/+3
| | | | This reverts commit ee2be435b1e5c0e94a4ee93a1a310e0471a77d07.
* Raise error on unknown primary key.Jon Leighton2011-10-051-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 Leighton2011-09-131-2/+1
| | | | | For consistency with find_or_initialize_by. Also remove first_or_build alias.
* Using more precise method signatures for AR::Relation#first_or_create family ↵Andrés Mejía2011-09-061-6/+6
| | | | of methods.
* Adding first example with no arguments to AR::Relation#first_or_create and ↵Andrés Mejía2011-09-061-15/+15
| | | | removing examples that create several users at the same time (this is confusing and not really helpful).
* Adding first_or_create, first_or_create!, first_or_new and first_or_build to ↵Andrés Mejía2011-08-301-0/+43
| | | | | | | | | | 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.
* Refactor building the update managerJon Leighton2011-08-151-5/+6
|
* Support updates with joins. Fixes #522.Jon Leighton2011-08-151-4/+9
|
* Make it the responsibility of the connection to hold onto an ARel visitor ↵Jon Leighton2011-08-081-7/+6
| | | | 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.
* Bring back the ability to provide :order for update_all.thedarkone2011-07-251-9/+5
|
* Foo.joins(:bar).includes(:bar) should result in a single query with :bar as ↵Jon Leighton2011-07-091-1/+11
| | | | a join. Related: #1873.
* Use Enumerable#with_index. We're on Ruby > 1.8.7Akira Matsuda2011-07-081-2/+1
|
* Add require ActiveSupport delegation to ActiveRecord::Relation class.Dmitriy Kiriyenko2011-07-071-0/+1
|
* default create_with_value to a hash so we can eliminate conditionals, add ↵Aaron Patterson2011-06-271-2/+3
| | | | test surrounding create_with(nil) behavior
* Fix issue #1272Brian Mathiyakom2011-06-011-1/+1
| | | | | Set reverse_order_value when asked to reverse_order(). Do the actual reversal in build_arel.
* delegate connection and column_hash calls directly to modelHemant Kumar2011-05-281-1/+1
|
* Merge branch 'master' of git://github.com/lifo/docrailsXavier Noria2011-05-251-2/+2
|\ | | | | | | | | | | Conflicts: actionmailer/lib/action_mailer/base.rb activesupport/lib/active_support/core_ext/kernel/requires.rb
| * Remove extra white spaces on ActiveRecord docs.Sebastian Martinez2011-05-231-2/+2
| |
* | Fix infinite recursion where a lazy default scope references a scope. Fixes ↵Jon Leighton2011-05-251-1/+1
| | | | | | | | #1264.
* | Ensure that the surrounding code in Relation#to_a respects the default_scope ↵Jon Leighton2011-05-241-17/+24
|/ | | | (as well as having Relation#arel respect the default scope). Fixes #1233.
* using bind parameters for updatesAaron Patterson2011-04-301-1/+1
|
* postgresql supports prepare statement deletesAaron Patterson2011-04-291-1/+3
|
* Use existing #empty_insert_statement_value for an insert with no columns.Ken Collins2011-04-241-1/+1
|
* The #substitute_at gets an ActiveRecord::ConnectionAdapters::Column in ↵Ken Collins2011-04-231-1/+1
| | | | #insert to match replacement in #exec_query.
* sort insert columns for better cache hitsAaron Patterson2011-04-141-1/+1
|
* refactoring inserts to use the same method on the connectionAaron Patterson2011-04-141-21/+16
|
* insert statements are prepared, but values are not escaped properlyAaron Patterson2011-04-141-6/+24
|
* ActiveRecord::Base.scopes hash is not neededJon Leighton2011-04-121-2/+0
|
* Evaluate default scopes at the last possible moment in order to avoid ↵Jon Leighton2011-04-121-3/+14
| | | | 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-6/+1
| | | | favour of defining a 'default_scope' class method in the model. See the CHANGELOG for more details.
* Use IM when trying to load records using ID.Emilio Tagua2011-04-041-0/+3
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Quote find_in_batches ORDER BY clause [#6620 state:resolved]Andrew White2011-03-291-1/+1
|
* pushing id insertion and prefetch primary keys down to Relation#insertAaron Patterson2011-03-221-3/+14
|
* Fixed a bug when empty? was called on a grouped Relation that wasn't loadedChris Oliver2011-03-121-1/+4
| | | | | | [#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-1/+12
| | | | to be eager-loaded via a JOIN rather than via subsequent queries.
* Rewrote AssociationPreload.Jon Leighton2011-02-281-1/+3
|
* only take the limit if there is a limit to takeAaron Patterson2011-02-251-1/+1
|
* Relation will delegate to AR::Base which already uses the Dynamic finders, ↵Aaron Patterson2011-02-221-8/+3
| | | | so eliminate duplicate calls
* Adding new examples for update_all methodRodrigo Navarro2011-02-201-0/+6
|
* Adding examplesRodrigo Navarro2011-02-201-0/+2
|
* Merge remote branch 'rails/master' into identity_mapEmilio Tagua2011-02-151-16/+22
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/examples/performance.rb activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/association_proxy.rb activerecord/lib/active_record/autosave_association.rb activerecord/lib/active_record/base.rb activerecord/lib/active_record/nested_attributes.rb activerecord/test/cases/relations_test.rb
| * primary keys should not be cleared on cache clear, fixing oracle testsAaron Patterson2011-02-081-1/+8
| |
| * ActiveRecord::Relation#primary_key should return a string, just like ↵Jon Leighton2011-01-031-13/+6
| | | | | | | | ActiveRecord::Base.primary_key does.
| * use the sql literal factory methodAaron Patterson2010-12-241-1/+1
| |
| * stop the recursive insanityAaron Patterson2010-12-241-5/+10
| |
| * setting the primary key on the update managerAaron Patterson2010-12-241-0/+1
| |
| * fixed retrieval of primary key value in Ralation#insert methodRaimonds Simanovskis2010-12-231-1/+1
| | | | | | | | previously primary key value was always assigned nil which caused Oracle enhanced adapter failing tests