aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation
Commit message (Collapse)AuthorAgeFilesLines
...
| * Stop accepting `options` for `Relation#average`, `Relation#minimum`, ↵Vipul A M2013-10-141-10/+10
| | | | | | | | `Relation#maximum`, `Relation#calculate`, `perform_calculation`, `NullRelation#calculate` as they isn't used anymore.
| * `Relation#count` doesn't use options anymore.Vipul A M2013-10-131-3/+2
| |
| * Merge pull request #11791 from versioncontrol/includes_with_persistent_selectRafael Mendonça França2013-10-121-1/+1
| |\ | | | | | | Includes with persistent select, fixes #11773
| | * Fixes #11773 when using includes combined with select, the select statement ↵Edo Balvers2013-10-081-1/+1
| | | | | | | | | | | | was overwritten.
* | | keep a cache on the alias objectAaron Patterson2013-10-141-1/+1
| | |
* | | store aliases in a better structureAaron Patterson2013-10-141-1/+3
| | |
* | | eliminate single use methodAaron Patterson2013-10-131-6/+3
| | |
* | | eliminate duplicate code from to_sqlAaron Patterson2013-10-131-4/+8
| | | | | | | | | | | | I don't really like passing the block, but this seems easiest for now
* | | calling construct_relation_for_association_find is no longer necessaryAaron Patterson2013-10-131-1/+1
| | |
* | | push up `select` exclusionAaron Patterson2013-10-131-3/+4
| | |
* | | JoinDependency will take care of making things uniqueAaron Patterson2013-10-131-1/+1
|/ /
* | merge JoinDependency as outer joinsAaron Patterson2013-10-101-1/+1
| | | | | | | | Merge JoinDependency objects as outer joins
* | stuff the join dependency object in the "anything goes" hash.Aaron Patterson2013-10-103-4/+6
| |
* | stop splatting things back and forthAaron Patterson2013-10-101-1/+1
| |
* | hide join_constraints inside the JoinDependency objectAaron Patterson2013-10-091-2/+1
|/
* Merge branch 'master' of github.com:rails/docrailsVijay Dev2013-09-281-1/+1
|\
| * `skiping` => `skipping`Vipul A M2013-09-171-1/+1
| |
* | Merge pull request #12011 from jetthoughts/11963_fix_join_with_association_scopeRafael Mendonça França2013-09-161-6/+5
|\ \ | | | | | | | | | | | | | | | | | | Collapse where constraints to the Arel::Nodes::And node Conflicts: activerecord/CHANGELOG.md
| * | Collapse where constraints to one where constraintPaul Nikitochkin2013-09-131-6/+5
| | | | | | | | | | | | | | | | | | | | | In order to remove duplication with joining arel where constraints with `AND`, all constraints on `build_arel` are collapsed into one head node: `Arel::Nodes::And` Closes: #11963
* | | Merge pull request #12129 from Empact/deprecate-array-bang-delegationRafael Mendonça França2013-09-121-3/+14
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Deprecate the delegation of Array bang methods in ActiveRecord::Delegation Conflicts: activerecord/CHANGELOG.md activerecord/test/cases/relation_test.rb
| * | | Deprecate the delegation of Array bang methods in ActiveRecord::DelegationBen Woosley2013-09-041-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The primary means of returning results for Array bang methods is to modify the array in-place. When you call these methods on a relation, that array is created, modified, and then thrown away. Only the secondary return value is exposed to the caller. Removing this delegation is a straight-forward way to reduce user error by forcing callers to first explicitly call #to_a in order to expose the array to be acted on by the bang method.
* | | | Merge pull request #12156 from rywall/from-copy-bindsRafael Mendonça França2013-09-121-0/+1
|\ \ \ \ | |_|_|/ |/| | | | | | | | | | | | | | | | | | | Allow Relation#from to accept other relations with bind values. Conflicts: activerecord/CHANGELOG.md
| * | | Allow Relation#from to accept other relations with bind values.Ryan Wallace2013-09-081-0/+1
| | |/ | |/|
* / | Relation#merge should not lose readonly(false) flag.thedarkone2013-09-111-1/+5
|/ / | | | | | | The original code ignores the `false` value because `false.blank? # => true`.
* | Merge pull request #11958 from jetthoughts/extract_pre_process_orders_argsYves Senn2013-09-041-13/+16
|\ \ | |/ |/| Re-use order arguments pre-processing for reorder
| * Extracted from `order` processing of arguments, and use it for `reorder` to ↵Paul Nikitochkin2013-09-041-13/+16
| | | | | | | | be consistent.
* | Don't use Enumerable#next in pluck since it is very slowRyan Wallace2013-08-301-2/+1
| |
* | Merge pull request #12090 from njakobsen/merger-performanceAaron Patterson2013-08-301-3/+3
|\ \ | | | | | | [Performance] Don't create fibers while merging bind variables
| * | Don't create fibers just to iterateNicholas Jakobsen2013-08-301-3/+3
| |/
* | no need to fully qualifyAaron Patterson2013-08-301-1/+1
| |
* | move the cache to the AR models and populate it on inheritedAaron Patterson2013-08-301-20/+29
| |
* | no need for the const_get since we lockAaron Patterson2013-08-301-5/+1
| |
* | require a class for cache computationsAaron Patterson2013-08-301-1/+3
| |
* | cache misses should return selfAaron Patterson2013-08-301-1/+1
|/
* check class hierarchy with is_a? in PredicateBuilder.expandMikhail Dieterle2013-08-271-1/+1
| | | | add changelog entry for #11945
* let AR::FinderMethods#exists? return singletons in all cases [closes #11592]Xavier Noria2013-08-191-7/+7
| | | | | | | | | | | | | | | | | | | | | This fixes a regression. The documentation said in its introduction paragraph that the method returns truthy/falsy, but then below it was said that if there were no arguments you'd get `true` or `false`. Also when the argument is exactly `false` a singleton is documented to be returned. The method was not returning the singletons so it didn't conform to those special cases. The best solution here seems to be to just return singletons in all cases. This solution is backwards compatible. Also, the contract has been revised because it has no sense that the predicate varies that way depending on the input. I bet the previous contract was just an accident, not something mixed on purpose. Conflicts: activerecord/lib/active_record/relation/finder_methods.rb activerecord/test/cases/finder_test.rb
* Minor optimization and code cleanup in query_methods.Eugene Gilburg2013-07-311-38/+45
| | | | | | | | - Use symbols rather than strings where possible to avoid extra object construction - Use destructive methods where possible to avoid extra object construction - Use array union rather than concat followed by uniq - Use shorthand block syntax where possible - Use consistent multiline block styles, method names, method parenteses style, and spacing
* Merge branch 'revert-order-prepending'Rafael Mendonça França2013-07-301-2/+2
|\ | | | | | | | | Conflicts: activerecord/CHANGELOG.md
| * Revert change on ActiveRecord::Relation#order method that prepends newRafael Mendonça França2013-07-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | order on the old ones The previous behavior added a major backward incompatibility since it impossible to have a upgrade path without major changes on the application code. We are taking the most conservative path to be consistent with the idea of having a smoother upgrade on Rails 4. We are reverting the behavior for what was in Rails 3.x and, if needed, we will implement a new API to prepend the order clauses in Rails 4.1.
* | Add ability to specify how a class is converted to Arel predicatesgrif2013-07-283-35/+74
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the ability for rails apps or gems to have granular control over how a domain object is converted to sql. One simple use case would be to add support for Regexp. Another simple case would be something like the following: class DateRange < Struct.new(:start, :end) def include?(date) (start..end).cover?(date) end end class DateRangePredicate def call(attribute, range) attribute.in(range.start..range.end) end end ActiveRecord::PredicateBuilder.register_handler(DateRange, DateRangePredicate.new) More complex cases might include taking a currency object and converting it from EUR to USD before performing the query. By moving the existing handlers to this format, we were also able to nicely refactor a rather nasty method in PredicateBuilder.
* stop relying on side effects of const_missingAaron Patterson2013-07-231-7/+7
|
* add a specific factory method rather than using newAaron Patterson2013-07-233-6/+4
|
* Improve ActiveRecord::QueryMethods#includes docsHenrik Hodne2013-07-171-0/+8
| | | | | | | | It's not immediately clear whether you can pass in multiple relations or not. After going through the code a bit, I saw that the arguments are just appended to an array. Also, added nested relations example. [ci skip]
* decouple the manager class from building join constraintsAaron Patterson2013-07-161-4/+5
|
* save another array allocationAaron Patterson2013-07-151-1/+1
|
* removing useless assingmentAaron Patterson2013-07-151-1/+1
|
* reorder bind parameters when merging relationsAaron Patterson2013-07-151-2/+18
|
* use arel rather than slapping together SQL stringsAaron Patterson2013-07-151-2/+4
|
* Merge pull request #11439 from ernie/only-scan-strings-for-nodesYves Senn2013-07-141-1/+1
|\ | | | | Blacklist->whitelist for reference scans in order!
| * Blacklist->whitelist for reference scans in order!Ernie Miller2013-07-141-1/+1
| | | | | | | | | | | | Stop special-casing Arel::Nodes as exempt from reference scanning in order. Instead, only scan order values that are strings for a table reference.