aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/predicate_builder.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove ActiveRecord::ModelJon Leighton2012-10-261-3/+3
| | | | | | | | | | In the end I think the pain of implementing this seamlessly was not worth the gain provided. The intention was that it would allow plain ruby objects that might not live in your main application to be subclassed and have persistence mixed in. But I've decided that the benefit of doing that is not worth the amount of complexity that the implementation introduced.
* rename AR::Model::Tag to AR::Tag - fixes #7714Francesco Rodriguez2012-09-201-1/+1
|
* fix querying with an empty hashDamien Mathieu2012-09-191-2/+6
| | | | Closes #6960
* Pass in the model class rather than engineJon Leighton2012-09-131-5/+5
| | | | | | | | | In some circumstances engine was Arel::Table.engine which for separate reasons was an ActiveRecord::Model::DeprecationProxy, which caused a deprecation warning. In any case, we want the actual model class here, since we want to use it to infer information about associations.
* Refactor to remove some duplicationJon Leighton2012-09-121-37/+20
|
* Fix nested association referencesJon Leighton2012-09-121-3/+4
| | | | | Previously the reflection would be looked up on the wrong class. However the test passed because the examples referred back to themselves.
* Accept belongs_to assoc. keys in ActiveRecord queriesbeerlington2012-09-111-4/+48
| | | | | | | | | | | | | Allows you to specify the model association key in a belongs_to relationship instead of the foreign key. The following queries are now equivalent: Post.where(:author_id => Author.first) Post.where(:author => Author.first) PriceEstimate.where(:estimate_of_type => 'Treasure', :estimate_of_id => treasure) PriceEstimate.where(:estimate_of => treasure)
* Remove conditional committed by accidentSantiago Pastorino2012-06-091-1/+1
|
* Use each_with_object instead of each hereSantiago Pastorino2012-06-091-1/+1
|
* predicate builder should not recurse for determining where columns.Aaron Patterson2012-05-301-1/+1
| | | | | | Thanks to Ben Murphy for reporting this CVE-2012-2661
* CollectionProxy < RelationJon Leighton2012-05-111-3/+3
| | | | | | | | | | | | | | | | | | | | | This helps bring the interfaces of CollectionProxy and Relation closer together, and reduces the delegation backflips we need to perform. For example, first_or_create is defined thus: class ActiveRecord::Relation def first_or_create(...) first || create(...) end end If CollectionProxy < Relation, then post.comments.first_or_create will hit the association's #create method which will actually add the new record to the association, just as post.comments.create would. With the previous delegation, post.comments.first_or_create expands to post.comments.scoped.first_or_create, where post.comments.scoped has no knowledge of the association.
* Remove Arel::Relation constant from PredicateBuilder.Juanjo Bazán2012-03-271-2/+2
|
* Refactor and cleanup in some ActiveRecord modulesCarlos Antonio da Silva2012-03-031-14/+13
| | | | | | | | | | | * Avoid double hash lookups in AR::Reflection when reflecting associations/aggregations * Minor cleanups: use elsif, do..end, if..else instead of unless..else * Simplify DynamicMatchers#respond_to? * Use "where" instead of scoped with conditions hash * Extract `scoped_by` method pattern regexp to constant * Extract noisy class_eval from method_missing in dynamic matchers * Extract readonly check, avoid calling column#to_s twice in persistence * Refactor predicate builder, remove some variables
* automatically add references when we canJon Leighton2012-01-161-0/+12
|
* refactor AR::PredicateBuilder.build_from_hashAkira Matsuda2011-12-291-35/+37
|
* where(foo: [1, nil]) becomes "WHERE foo = 1 OR foo IS NULL"Akira Matsuda2011-12-281-1/+4
| | | | was "WHERE foo IN (1) OR foo IS NULL" before
* no need to compact an already compacted ArrayAkira Matsuda2011-12-281-1/+1
|
* Make PredicateBuilder recognise AR::ModelJon Leighton2011-12-241-2/+2
|
* pushing caching and visitors down to the connectionAaron Patterson2011-11-191-1/+1
|
* Fixes issue #3483, regarding using a mixture of ranges and discrete values ↵Ryan Naughton2011-11-141-6/+8
| | | | in find conditions. Paired with Joey Schoblaska.
* 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
|
* supporting nil when passed in as an IN clauseAaron Patterson2011-04-291-1/+12
|
* use Arel::Table#alias rather than passing the :as parameterAaron Patterson2011-03-051-2/+2
|
* Split AssociationProxy into an Association class (and subclasses) which ↵Jon Leighton2011-02-181-1/+1
| | | | manages the association, and a CollectionProxy class which is *only* a proxy. Singular associations no longer have a proxy. See CHANGELOG for more.
* use the arel table rather than generating stringsAaron Patterson2011-02-161-1/+1
|
* no need for Array.wrapAaron Patterson2011-02-161-1/+1
|
* removed an unnecessary second query when passing an ActiveRecord::Relation ↵Steven Fenigstein2011-02-161-1/+4
| | | | to a where clause. And added ability to use subselects in where clauses.
* User id instead of quoted_id to prevent double quoting. Fixes failing test ↵Robert Pankowecki (Gavdi)2011-01-041-1/+1
| | | | for bug #6036.
* arel can escape the id, so avoid using the database connectionAaron Patterson2010-12-221-1/+1
|
* Arel::Table#[] always returns an attribute, so no need for ||Aaron Patterson2010-12-221-1/+1
|
* to_sym stuff before passing it to arelAaron Patterson2010-12-221-1/+1
|
* just wrap as a sql literalAaron Patterson2010-11-231-2/+1
|
* Do not send id for quoting twice if the primary key is string.Neeraj Singh2010-11-231-1/+2
| | | | [#6022 state:resolved]
* support finding by a ruby class [#5979 state:resolved]Aaron Patterson2010-11-151-0/+3
|
* use quoted id of single AR::Base objects in predicatesAaron Patterson2010-11-151-0/+2
|
* avoid creating objects when we canAaron Patterson2010-10-031-11/+5
|
* passing the quoted id to arel if the object has a quoted idAaron Patterson2010-09-101-1/+3
|
* No need to check if the attribute exists (this is the same behavior as in ↵José Valim2010-06-291-3/+1
| | | | 2.3) [#4994 state:resolved] and [#5003 state:resolved]
* Fix small bug where ActiveRecord::PredicateBuilder#build_from_hash didn't ↵James Harton2010-06-221-1/+1
| | | | | | test for Arel::Relation as right hand value. [#4917 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Raise a StatementInvalid error when trying to build a condition with hash ↵Carl Lerche2010-04-031-1/+3
| | | | keys that do not correspond to columns.
* Goodbye ActiveRecord::NamedScope::ScopePratik Naik2010-04-021-1/+1
|
* Arel now handles ranges with excluded end.Emilio Tagua2010-03-291-6/+1
|
* Arel now fallback to using Arel::Attribute if the table/column doesn't exists.Emilio Tagua2010-03-101-3/+1
| | | | | | [#4142 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Fix scope loading issue when the table doesn't existPratik Naik2010-03-101-1/+3
|
* Rely on arel to generate the correct sql when an empty array is supplied to ↵Pratik Naik2010-01-301-1/+1
| | | | IN predicate
* Handle invalid query IN() generated when a blank array is supplied in hash ↵Pratik Naik2010-01-181-1/+2
| | | | conditions
* Inherit named scope class Scope from RelationPratik Naik2010-01-181-1/+1
|
* Rename Model.arel_table to Model.active_relationPratik Naik2010-01-021-5/+5
|
* Handle Range with excluded endPratik Naik2010-01-011-1/+8
|