aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation
Commit message (Collapse)AuthorAgeFilesLines
* fix querying with an empty hashDamien Mathieu2012-09-191-2/+6
| | | | Closes #6960
* Fix find_in_batches with customized primary_keyToshiyuki Kawanishi2012-09-161-6/+7
|
* Pass in the model class rather than engineJon Leighton2012-09-132-6/+6
| | | | | | | | | 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-112-4/+66
| | | | | | | | | | | | | 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)
* Fix pluck when columns/tables are reserved words.Ian Lesperance2012-09-051-1/+1
|
* Model.select takes a variable list of arguments.Isaac Sanders2012-08-231-11/+12
| | | | | | This is a cleaner version of #6916. Closes #3165.
* Fix "last equality wins" logic in relation mergeErnie Miller2012-08-191-10/+5
| | | | | | This is a real fix (as compared to the band-aid in b127d86c), which uses the recently-added equality methods for ARel nodes. It has the side benefit of simplifying the merge code a bit.
* Fix merge error when Equality LHS is non-attributeErnie Miller2012-08-171-2/+5
| | | | | | | | | This is at best a band-aid for a more proper fix, since it won't truly handle the removal of the previous equality condition of these other nodes. I'm planning to put in some work on ARel toward supporting that goal. Related: rails/arel#130, ernie/squeel#153, ernie/squeel#156
* Allow Relation#merge to take a proc.Jon Leighton2012-08-031-2/+13
| | | | | | | | | | | | | | | | | | This was requested by DHH to allow creating of one's own custom association macros. For example: module Commentable def has_many_comments(extra) has_many :comments, -> { where(:foo).merge(extra) } end end class Post < ActiveRecord::Base extend Commentable has_many_comments -> { where(:bar) } end
* load active_support/core_ext/module/delegation in active_support/railsXavier Noria2012-08-021-1/+0
|
* load active_support/core_ext/object/blank in active_support/railsXavier Noria2012-08-026-6/+0
|
* AR::Relation#order: make new order prepend old oneBogdan Gusiev2012-07-312-3/+3
| | | | | | | User.order("name asc").order("created_at desc") # SELECT * FROM users ORDER BY created_at desc, name asc This also affects order defined in `default_scope` or any kind of associations.
* Revert "Removing composed_of from ActiveRecord."Rafael Mendonça França2012-07-271-1/+2
| | | | | | | | | | | This reverts commit 14fc8b34521f8354a17e50cd11fa3f809e423592. Reason: we need to discuss a better path from this removal. Conflicts: activerecord/lib/active_record/reflection.rb activerecord/test/cases/base_test.rb activerecord/test/models/developer.rb
* Changelog and doc updates for the previous changes.Jon Leighton2012-07-271-6/+6
|
* Deprecate Relation#all.Jon Leighton2012-07-272-15/+2
| | | | | | It has been moved to active_record_deprecated_finders. Use #to_a instead.
* Deprecate ActiveRecord::Base.scoped.Jon Leighton2012-07-271-1/+1
| | | | | | | It doesn't serve much purpose now that ActiveRecord::Base.all returns a Relation. The code is moved to active_record_deprecated_finders.
* improve NullRelation docs [ci skip]Vijay Dev2012-07-211-4/+4
|
* minor copy edits [ci skip]Vijay Dev2012-07-211-1/+1
|
* Add nodocs to delegation module and docs for merge!Oscar Del Ben2012-07-172-1/+2
|
* Update batches docsOscar Del Ben2012-07-171-6/+6
|
* Add nodoc to HashMerger and MergerOscar Del Ben2012-07-171-2/+2
|
* TypoOscar Del Ben2012-07-161-1/+0
|
* Add documentation for query_methods bang methodsOscar Del Ben2012-07-161-1/+20
|
* Add nodoc to create_with_valueOscar Del Ben2012-07-161-1/+1
| | | | | Reason: all *_value methods are defined dynamically and so don't appear in the documentation.
* Add documentation for arel and build_arelOscar Del Ben2012-07-161-0/+2
|
* Add documentation for create_withOscar Del Ben2012-07-161-1/+19
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-07-151-2/+39
|\
| * Add docs for having, lock and readonlyOscar Del Ben2012-07-071-0/+12
| |
| * Add doc for joins and improve includes docOscar Del Ben2012-07-071-2/+17
| |
| * Add docs for eager_laod and preloadOscar Del Ben2012-07-071-0/+10
| |
* | fix association :extend optionJon Leighton2012-07-131-1/+1
| |
* | support relations created with a table aliasJon Leighton2012-07-131-1/+1
|/
* minor text change [ci skip]Vijay Dev2012-07-071-1/+1
|
* Revert "Add nodoc to relation methods"Vijay Dev2012-07-071-22/+24
| | | | | | This reverts commit c47a698d5d497340d4e349257522212173865838. Reason: Let's revert pending further discussions
* Add nodoc to relation methodsOscar Del Ben2012-07-061-24/+22
|
* Add order docsOscar Del Ben2012-07-051-0/+10
|
* Add group documentationOscar Del Ben2012-07-051-0/+12
|
* Add documentation for includesOscar Del Ben2012-07-051-0/+11
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-06-301-5/+7
|\ | | | | | | | | Conflicts: activemodel/lib/active_model/errors.rb
| * update AR::FinderMethods#exists?(false) example [ci skip]Francesco Rodriguez2012-06-281-5/+7
| |
* | fixing typo in from documentationSubba Rao Pasupuleti2012-06-281-2/+2
| |
* | Use args.flatten! in query methods when applicableCarlos Antonio da Silva2012-06-251-7/+12
| | | | | | | | | | Try to use more destructive methods on *args when applicable, to avoid creating new objects.
* | Merge pull request #6544 from flexoid/issue-6431Piotr Sarnacki2012-06-251-6/+6
|\ \ | | | | | | exists?(false) returns false
| * | exists?(false) returns falseEgor Lynko2012-06-251-6/+6
| | | | | | | | | | | | `FinderMethods#exists?` finder method now returns *false* with the *false* argument
* | | Ensure Arel columns are typecasted properly when grouping with calculationCarlos Antonio da Silva2012-06-251-6/+6
|/ / | | | | | | Fix build issue with postgresql.
* / Stop assuming strings for grouped calculationsErnie Miller2012-06-241-6/+17
|/ | | | | | | | | | | | | | | Execute_grouped_calculation is one of those places where ActiveRecord forgets that it has ARel underpinnings, and assumes that the values provided to group_values are strings. This artificially hobbles otherwise functional code. This patch stops assuming that incoming values respond to to_sym, stops using string interpolation for table aliases on objects that support aliasing, and stops unnecessarily joining group_values on the relation. Additionally, it calls to_sql, if available, on objects sent to column_alias_for, in order to get a more reasonable alias string than a non-string's default to_str method.
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-06-221-3/+15
|\
| * fixes a few mistakes in api docs [ci skip]Vijay Dev2012-06-221-4/+2
| |