aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation
Commit message (Collapse)AuthorAgeFilesLines
* Revert "allow select to have multiple arguments"Piotr Sarnacki2011-07-261-6/+3
| | | | | | | This reverts commit 04cc446d178653d362510e79a22db5300d463161. I reverted it because apparently we want to use: select([:a, :b]) instead of select(:a, :b), but there was no tests for that form.
* allow select to have multiple argumentsSławosz Sławiński2011-07-261-3/+6
|
* Ordering with extra spaces was raising a SQL exceptionFranck Verrot2011-07-241-0/+1
|
* avoid Symbol#to_procVijay Dev2011-07-201-1/+1
|
* ActiveRecord: Fix eager loading so that giving a blank order clause ↵Elliot Winkler2011-07-181-1/+1
| | | | generates valid SQL
* Merge pull request #1807 from caius/find_in_batches_id_bugSantiago Pastorino2011-07-141-2/+5
|\ | | | | Bugfix by stopping find_in_batches using the records after yielding.
| * Stop find_in_batches using the records after yielding.Caius Durling2011-06-211-2/+5
| | | | | | | | | | | | Currently if the code that calls .find_in_batches modifies the yielded array in place then .find_in_batches can enter an infinite loop searching with ruby object ids in the database instead of the primary key of records in the database. This happens because it naively assumes the yielded array hasn't been modified before calling #id on the last object in the array. And ruby (1.8 at least) alias' #id to #object_id so an integer is still returned no matter what the last object is. By moving finding the #id of the last object before yielding the array it means the calling code can do whatever it wants to the array in terms of modifying it in place, and .find_in_batches doesn't care.
* | Merge pull request #1823 from gnarg/masterSantiago Pastorino2011-07-101-2/+2
|\ \ | | | | | | Log instrumentation name for exists? queries
| * | Log instrumentation name for exists? queriesJon Guymon2011-06-221-2/+2
| | |
* | | fix AR having() not to raise NoMethodError when the given argument does not ↵Akira Matsuda2011-07-091-3/+3
| | | | | | | | | | | | | | | | | | respond to empty? having raises NoMethodError: undefined method `empty?' when a Fixnum or Date/Time were passed via varargs
* | | Make `ActiveRecord::Batches#find_each` to not return `self`.knapo2011-07-071-2/+0
| | | | | | | | | | | | This caused that `find_each` was producing extra db call taking all the records from db, and was less efficient than `ActiveRecord::Base#all`.
* | | Remove case statement changes from 2e0840d and 56ac32a. Inheritance FTW.Ernie Miller2011-07-061-1/+1
| | |
* | | Merge pull request #1273 from jeremyf/feature-association-proxy-sendSantiago Pastorino2011-07-061-0/+1
|\ \ \ | | | | | | | | 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/+1
| | | | | | | | | | | | | | | | of dynamic finder methods and the passing of the &block parameter for :find_by_attributes.
* | | | Fixed AR::Relation#sum compatibility with Array#sumBogdan Gusiev2011-07-051-2/+6
| | | | | | | | | | | | | | | | | | | | In order make Relation behavior closer to Array Made Relation#sum to accept block and delegate it to Array#sum
* | | | Fix caseOriol Gual2011-06-281-2/+1
| | | |
* | | | Update reverse order with new Arel NodesOriol Gual2011-06-281-1/+2
| | | |
* | | | default create_with_value to a hash so we can eliminate conditionals, add ↵Aaron Patterson2011-06-272-2/+2
| | | | | | | | | | | | | | | | test surrounding create_with(nil) behavior
* | | | Apply the default scope earlier when doing calculations. Fixes #1682.Jon Leighton2011-06-231-5/+11
| |/ / |/| |
* | | Support reversal of ARel orderings in reverse_sql_orderErnie Miller2011-06-201-3/+12
| |/ |/|
* | Fix issue #1272Brian Mathiyakom2011-06-011-8/+7
| | | | | | | | | | Set reverse_order_value when asked to reverse_order(). Do the actual reversal in build_arel.
* | Ensure that calculations properly override the select value even if it's set ↵Jon Leighton2011-05-311-2/+2
| | | | | | | | in the default scope. Fixes #1395.
* | Merge branch 'master' of git://github.com/lifo/docrailsXavier Noria2011-05-252-5/+5
|\ \ | |/ |/| | | | | | | 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-232-5/+5
| |
* | Add support for passing mass assignment roles to dynamic finders. Closes #1170.Andrew White2011-05-211-2/+2
| |
* | Syntax cleanup: for in => eachGuillermo Iguaran2011-05-191-1/+1
|/
* Bug fixes:Fadzril Muhamad & Joseph Palermo2011-05-121-5/+4
| | | | | | - If doing a count on a relation that has an :include and a :join, it does a distinct even though it should not. - When doing a count on a relation that has an :include, it always falls back to a old style left join when performing the count. Looks like it was broken here: https://github.com/rails/rails/commit/b9599502c9e738a5a1513e75d08f8d40ed408265
* Merge pull request #451 from baroquebobcat/fixing_last_for_issue_371Jon Leighton2011-05-081-1/+6
|\
| * Fix for #371Nick Howard2011-05-081-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | if a query contains a limit or an offset, ActiveRecord::FinderMethods#find_last had inconsistent behavior. If the records were loaded, it returned the last record in the cached list. If they were not, it reversed the order of the query and changed the limit to one. If the earlier limit was less than the total matching the query in the db, it would return a different record than if the records had been cached. This commit changes find_last so that it loads the records when getting the last record on a query containing a limit or an offset, which makes the behavior consistent.
* | Ensure that ORDER BY clauses from default scopes are not included in ↵Jon Leighton2011-05-081-1/+1
|/ | | | calculation queries. Fixes #406.
* supporting nil when passed in as an IN clauseAaron Patterson2011-04-291-1/+12
|
* deprecated the use of the guard_protected_attributes argument with ↵Josh Kalderimis2011-04-251-2/+2
| | | | attributes= in AR in favor of assign_attributes(attrs, :without_protection => true)
* stop using distinct on for the unique id queries. [#6450 state:resolved]Aaron Patterson2011-04-211-0/+2
|
* use index based substitution for bind parametersAaron Patterson2011-04-131-1/+1
|
* Evaluate default scopes at the last possible moment in order to avoid ↵Jon Leighton2011-04-122-4/+14
| | | | problems with default scopes getting included into other scopes and then being unable to remove the default part via unscoped.
* stop using deprecated methods in arelAaron Patterson2011-04-111-2/+2
|
* Use IM when trying to load records using ID.Emilio Tagua2011-04-041-0/+9
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Merge branch 'master' into zomgAaron Patterson2011-03-293-11/+23
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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: ...
| * Quote find_in_batches ORDER BY clause [#6620 state:resolved]Andrew White2011-03-291-1/+1
| |
| * Change exists? so that it doesn't instantiate records [#6127 state:resolved]Andrew White2011-03-291-4/+10
| |
| * Bring #reorder backSebastian Martinez2011-03-281-0/+4
| | | | | | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
| * removes unnecessary selfs, and mentions that first! and last! take no ↵Xavier Noria2011-03-261-4/+6
| | | | | | | | arguments in their API docs
| * No arguments for first! and last!Pratik Naik2011-03-251-4/+4
| |
| * comment typo fixJosh Susser2011-03-251-2/+2
| |
* | Use Arel to build subquery. Adapt tests to changed fixtures.John Mileham2011-03-241-13/+12
| |
* | Merge branch 'master' of github.com:rails/rails into count_behaviorJohn Mileham2011-03-244-3/+19
|\|
| * add #first! and #last! to models & relationsJosh Susser2011-03-241-0/+10
| |
| * Merge branch 'master' into fuuuAaron Patterson2011-03-221-0/+6
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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/+6
| | |
| * | Resolve some TODO comments which I decided did not need anything doneJon Leighton2011-03-121-1/+0
| | |