aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #2485 from akaspick/exists_fixJon Leighton2011-09-071-1/+3
|\ | | | | fix exists? to return false if passed nil (which may come from a missing
| * fix exists? to return false if passed nil (which may come from a missing URL ↵Andrew Kaspick2011-08-101-1/+3
| | | | | | | | param)
* | Use LIMIT sql word in last when it's possibleDamien Mathieu2011-09-051-1/+5
| |
* | use LIMIT SQL word in first - Closes #2783Damien Mathieu2011-09-051-1/+1
| |
* | We need to recorder here. Need to drop the order from default scope.Arun Agrawal2011-09-051-1/+1
| | | | | | Fixes #2832
* | Revert "Fixes bug in ActiveRecord::QueryMethods, #1697"Jon Leighton2011-09-041-2/+4
| | | | | | | | | | | | This reverts commit 0df27c98d982ec87d2fb48cfda82694eb267993e. Reverted due to failing test, see #2845.
* | Fixes bug in ActiveRecord::QueryMethods, #1697Joshua Wehner2011-08-311-4/+2
| | | | | | Replace split on comma with a regexp that will reverse all ASC/DESC specifically
* | The join_nodes must be passed to the JoinDependency initializer and ↵Jon Leighton2011-08-291-7/+2
| | | | | | | | therefore counted by the alias tracker. This is because the association_joins are aliased on initialization and then the tables are cached, so it is no use to alias the join_nodes later. Fixes #2556.
* | Fix PredicateBuilder clobbering select_values in subquery.Ernie Miller2011-08-201-1/+1
| |
* | Fix assumption of primary key name in PredicateBuilder subquery.Ernie Miller2011-08-201-1/+1
|/
* Make it the responsibility of the connection to hold onto an ARel visitor ↵Jon Leighton2011-08-082-5/+5
| | | | 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.
* Revert "Merge pull request #2309 from smasry/master"Jon Leighton2011-07-281-1/+1
| | | | | | | This reverts commit 9d396ee8195e31f646e0b89158ed96f4db4ab38f, reversing changes made to fa2bfd832c1d1e997d93c2269a485cc74782c86d. Reason: the change broke the build.
* Reverse order fix when using function for ActiveRecord::QueryMethods Fixes #1697Samer Masry2011-07-271-1/+1
|
* Fixed failing query when performing calculation with having based on select.Dmitriy Kiriyenko2011-07-271-0/+1
|
* 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
|