aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #12084 from Ben-M/3-2-stableAaron Patterson2013-10-031-1/+1
|\ | | | | Fix STI scopes using benolee's suggestion. Fixes #11939
| * Fix STI scopes using benolee's suggestion. Fixes #11939Ben Maraney2013-08-301-1/+1
| |
* | Fix FinderMethods#last unscoped primary keyEugene Kalenkovich2013-09-121-2/+2
|/ | | | | | | | Fixes table.joins(:relation).last(N) breaking on sqlite Conflicts: activerecord/CHANGELOG.md activerecord/test/cases/finder_test.rb
* Fix merge error when Equality LHS is non-attribute.90yukke2013-07-231-2/+3
| | | | This is reworking of rails/rails/pull/7380 made for rails 3.
* Backport a super-simplified version of #6792, fixingBen Woosley2013-05-141-0/+1
| | | | | | | | | | | | | that #exists? and others can produce invalid SQL: "SELECT DISTINCT DISTINCT" The combination of a :uniq => true association and the #distinct call in #construct_limited_ids_condition combine to create invalid SQL, because we're explicitly selecting DISTINCT, and also sending #distinct on to AREL, via the relation#distinct_value. Where #6792 was the forever fix, this is the minimal fix. Instead of properly indicating the distinctness of the query through #uniq_value alone, we use a literal select statement and set #uniq_value to always be falsey
* Preserve context for joins while merging relationsAndrew Horner2013-05-111-1/+27
| | | | | | This is a backport of #10164, already merged into master. The issue is described in lengthy detail in issues #3002 and #5494.
* Using map. No need to run query againArun Agrawal2013-05-101-1/+1
|
* Fixed pluck to be working with selects.Arun Agrawal2013-05-101-1/+4
| | | | | | | | | | | | | See #9777 for details. Previously pluck is not returning what we wanted to Added a test also to make sure it's working fine. This will also fix the build for 1.8.7 as we were doing some sort on hash. Thanks @pixeltrix for helping me out. Thanks @linduxed for pairing with me.
* Remove useless elseArun Agrawal2013-05-101-3/+0
|
* Revert "Merge pull request #8209 from senny/backport_8176"Rafael Mendonça França2013-05-081-3/+2
| | | | | | | | | | | | | | | This reverts commit 724020278480855bddfe749c91f1074d4f50f3c6, reversing changes made to e4e2bcce75b85fb8c1c49509a17bd5dfe6034c32. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/relation/calculations.rb activerecord/test/cases/calculations_test.rb Reason: This caused a regression since it changed the behavior in a stable release. Fixes #9777
* Merge pull request #7792 from seejee/chained_scopes_preload_properlyCarlos Antonio da Silva2013-04-031-2/+7
|\ | | | | Fixes Issue #7490: Chained scopes will preload properly
| * Chained scopes will be preloaded properly. Fixes #7490Chris Geihsler2013-04-031-2/+7
| |
* | stop calling to_sym when building arel nodes [CVE-2013-1854]Aaron Patterson2013-03-151-1/+1
|/
* Revert "Merge pull request #9208 from dylanahsmith/3-2-mysql-quote-numeric"Steve Klabnik2013-02-261-4/+0
| | | | This reverts commit 921a296a3390192a71abeec6d9a035cc6d1865c8.
* fixing call to columns hash. run the damn tests when you backport!Aaron Patterson2013-02-091-1/+1
|
* active_record: Quote numeric values compared to string columns.Dylan Smith2013-02-071-0/+4
|
* Merge pull request #9078 from senny/6865_ar_count_with_uniqRafael Mendonça França2013-02-021-1/+2
| | | | | | `#count` in conjunction with `#uniq` performs distinct count. Conflicts: activerecord/CHANGELOG.md
* Fix pluck when columns/tables are reserved words.Ian Lesperance2013-01-231-1/+1
| | | | | | | | | Backport #7536 to fix #8968. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/relation/calculations.rb
* Revert "Merge pull request #7983 from georgebrock/bug7950-squashed"Carlos Antonio da Silva2013-01-153-10/+6
| | | | | | | | | | | This reverts commit 88a296dccc401da143d90cad54b693ff06bf2b58, reversing changes made to 666a7e34f553cef4c8878362eafc79c7e3f310c3. Conflicts: activerecord/CHANGELOG.md Reason: this has been resulting in some hard to track bugs and is introducing a possible breackage in a stable version.
* Merge branch '3-2-sec' into 3-2-secmergeAaron Patterson2013-01-081-1/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | * 3-2-sec: bumping version CVE-2013-0156: Safe XML params parsing. Doesn't allow symbols or yaml. * Strip nils from collections on JSON and XML posts. [CVE-2013-0155] * dealing with empty hashes. Thanks Damien Mathieu Avoid Rack security warning no secret provided Conflicts: actionpack/CHANGELOG.md activerecord/CHANGELOG.md activesupport/CHANGELOG.md
| * * Strip nils from collections on JSON and XML posts. [CVE-2013-0155] * ↵Aaron Patterson2013-01-081-1/+6
| | | | | | | | dealing with empty hashes. Thanks Damien Mathieu
* | backport #8403, no intermediate AR objects when eager loading.Yves Senn2012-12-041-2/+4
| | | | | | | | | | | | | | | | | | Closes #3313 Conflicts: activerecord/CHANGELOG.md activerecord/test/models/developer.rb
* | Merge pull request #4942 from bogdan/pluck_joinsJosé Valim2012-12-031-1/+6
| | | | | | | | | | | | | | | | AR::Relation#pluck: improve to work with joins Conflicts: activerecord/lib/active_record/relation/calculations.rb activerecord/test/cases/calculations_test.rb
* | Merge pull request #7983 from georgebrock/bug7950-squashedCarlos Antonio da Silva2012-11-163-6/+10
|\ \ | | | | | | | | | | | | | | | | | | | | | Backport 4bc2ae0 to fix #7950 Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/relation/calculations.rb
| * | use bind values for join columnsAaron Patterson2012-11-103-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a backport of 4bc2ae0da1dd812aee759f6d13ad428354cd0e13. It fixes bug #7950. Conflicts: activerecord/lib/active_record/relation/calculations.rb activerecord/lib/active_record/relation/finder_methods.rb
* | | Merge pull request #8209 from senny/backport_8176Rafael Mendonça França2012-11-131-1/+3
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | backport #8176, `#pluck` can be used on a relation with `select` clause. Conflicts: activerecord/CHANGELOG.md
| * | | backport #8176, `#pluck` can be used on a relation with `select` clause.Yves Senn2012-11-131-1/+3
| |/ / | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/relation/calculations.rb activerecord/test/cases/calculations_test.rb
* / / Use nil? instead of blank? to check dynamic finder resultNikita Afanasenko2012-11-131-1/+1
|/ / | | | | | | | | | | | | It's safe to use `nil?` instead of `blank?` because it's impossible to get an array on finder with bang; `all_by` finder matches against regex without bang: `when /^find_(all_|last_)?by_([_a-zA-Z]\w*)$/`. Fixes #7238
* | Fix find_in_batches against string IDs when start option is not specified.Alexis Bernard2012-11-081-2/+2
| | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/relation/batches.rb
* | start could be a stringSantiago Pastorino2012-11-081-1/+1
|/ | | | | | | | | | Related to 761bc751d31c22e2c2fdae2b4cdd435b68b6d783 and eb876c4d07130f15be2cac7be968cc393f959c62 Conflicts: activerecord/lib/active_record/relation/batches.rb activerecord/test/cases/batches_test.rb
* Ensure Arel columns are typecasted properly when grouping with calculationCarlos Antonio da Silva2012-06-251-3/+3
| | | | | | | | Fix build issue with postgresql. Conflicts: activerecord/lib/active_record/relation/calculations.rb activerecord/test/cases/calculations_test.rb
* Merge pull request #6842 from ernie/handle-non-strings-in-grouped-calculationsRafael Mendonça França2012-06-241-6/+17
| | | | | | Stop assuming strings for grouped calculations Conflicts: activerecord/lib/active_record/relation/calculations.rb
* Additional fix for CVE-2012-2661Ernie Miller2012-06-111-3/+3
| | | | | | | | While the patched PredicateBuilder in 3.1.5 prevents a user from specifying a table name using the `table.column` format, it doesn't protect against the nesting of hashes changing the table context in the next call to build_from_hash. This fix covers this case as well.
* Merge pull request #6698 from yahonda/address_ora_911_masterRafael Mendonça França2012-06-111-1/+1
| | | | Address ORA-00911 errors because of the heading underscore.
* Merge pull request #6521 from Empact/throw-resultRafael Mendonça França2012-06-101-0/+2
| | | | | | Fix that #exists? can blow up with ThrowResult exception Conflicts: activerecord/lib/active_record/relation/finder_methods.rb
* Minimal change to query generation of exists? that makes SQLServer and ↵iaddict2012-06-101-1/+1
| | | | | | | others happy that do not work without a column alias. Conflicts: activerecord/lib/active_record/relation/finder_methods.rb
* Merge pull request #6695 from kennyj/fix_6635Rafael Mendonça França2012-06-101-5/+5
| | | | Fix #6635. We should call Scoping methods, before calling Array methods.
* predicate builder should not recurse for determining where columns.Aaron Patterson2012-05-301-3/+3
| | | | | | Thanks to Ben Murphy for reporting this CVE-2012-2661
* Return false for exists? with new records - fixes #6199.Andrew White2012-05-101-2/+1
| | | | (cherry picked from commit fa21b73ebb8339ad388f149c817c433b6254d490)
* fix activerecord query_method regression with offset into FixnumDenis Jean2012-03-131-1/+1
| | | | | | add test to show offset query_methods on mysql & mysql2 change test to cover public API
* Add dynamic find_or_create_by_{attribute}! method.Andrew White2012-03-121-1/+1
| | | | | | | | | (cherry picked from commit 5282485d310d1a6ffcf55e4e7f56ab234e16880d) Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/dynamic_finder_match.rb
* prepared statements can be disabledAaron Patterson2012-02-211-1/+1
|
* select doesn't take multiple arguments - fixes #4539 [ci skip]Vijay Dev2012-01-191-2/+2
| | | | | Didn't cherry pick the master commit because this one already had some of the fixes made in master.
* add documentation explaining reorder behaviorMatt Jones2012-01-111-0/+10
|
* Merge pull request #4282 from edgecase/order_after_reorderAaron Patterson2012-01-043-7/+17
| | | | correctly handle order calls after a reorder
* Merge pull request #4216 from edgecase/master_fix_reorder_with_limited_idsAaron Patterson2011-12-281-1/+1
| | | | allow reorder to affect eager loading correctly
* Remove empty line.Marcos Tapajós2011-12-281-1/+0
|
* Closes #4208Marcos Tapajós2011-12-271-2/+3
|
* Make ActiveRecord::Relation#pluck work with serialized attributesJon Leighton2011-12-221-4/+4
|
* Do not raise an exception if an invalid route was generated automatically.José Valim2011-12-161-1/+1
|