aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/association_collection.rb
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Don't overwrite unsaved updates when loading an association but ↵José Valim2010-06-111-1/+1
| | | | | | | | preserve the order of the loaded records. [#4642 state:open]" This commit introduced a regression described in ticket [#4830]. This reverts commit 0265c708b9696c3943518ad5f3dabdc22c5eba11.
* Don't overwrite unsaved updates when loading an association but preserve the ↵James Le Cuirot2010-06-091-1/+1
| | | | | | order of the loaded records. [#4642 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Properly cache association_collection#scopes calls having argumentsPratik Naik2010-06-041-1/+2
|
* Ensure not to load the entire association when bulk updating existing ↵Pratik Naik2010-04-141-10/+10
| | | | records using nested attributes
* Avoid deprecated String#to_a by using Array.wrap(...) instead of Array(...)Jeremy Kemper2010-04-101-1/+2
|
* Some doc updates reflecting the new query APIPratik Naik2010-04-081-1/+1
|
* Reset named scope cache whenever the @target is resetPratik Naik2010-04-071-2/+9
|
* Memoize association.named_scope callsPratik Naik2010-04-051-0/+3
|
* keep AssociationProxy#to_a to avoid warning in Array(post.author), and ↵Xavier Noria2010-03-121-0/+1
| | | | | | | | delegate it to @target in association collections [#4165 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Get rid of construct_count_options_from_argsPratik Naik2010-01-191-3/+4
|
* Inherit named scope class Scope from RelationPratik Naik2010-01-181-2/+0
|
* Make scopes use relations under the hoodPratik Naik2010-01-161-3/+6
|
* Add Relation#includes to be an equivalent of current finder option :includePratik Naik2010-01-031-1/+1
|
* Get rid of Model.construct_finder_arel_with_includes. Use ↵Pratik Naik2010-01-031-1/+1
| | | | construct_finder_arel instead
* Get rid of DeprecatedCallbacks in ActiveRecord::Associations and finally ↵José Valim2009-12-301-1/+8
| | | | remove it.
* Migrate all the calculation methods to RelationPratik Naik2009-12-291-1/+1
|
* Add Model.having and Relation#havingPratik Naik2009-12-291-1/+1
|
* Add Model.readonly and association_collection#readonly finder methodPratik Naik2009-12-281-1/+1
|
* Add Model.lock and relation#lock now that arel has lockingPratik Naik2009-12-281-1/+1
|
* Add Model.from and association_collection#from finder methodsPratik Naik2009-12-281-1/+1
|
* Rewrite AssociationCollection#find using relationsPratik Naik2009-12-271-19/+13
|
* Add new finder methods to association collection.Pratik Naik2009-12-271-2/+17
|
* Callbacks, DeprecatedCallbacks = NewCallbacks, CallbacksJoshua Peek2009-10-121-1/+1
|
* Added back support for destroying an association's object by id. [#2306 ↵Joshua Nichols2009-08-091-0/+1
| | | | | | status:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Merge docrailsPratik Naik2009-07-251-2/+2
|
* Revert "Revert "Generate proper :counter_sql from :finder_sql when there is ↵Pratik Naik2009-07-011-1/+13
| | | | | | | | | a newline character immediately following 'SELECT' [#2118 state:resolved]"" This reverts commit 80f1f863cd0f9cba89079511282de5710a2e1832. The feature doesn't work on Postgres, so don't test it on Postgres. Also, Postgres compatibility is irrelevant to the ticket/patch in question.
* Revert "Generate proper :counter_sql from :finder_sql when there is a ↵Yehuda Katz + Carl Lerche2009-06-221-13/+1
| | | | | | | | newline character immediately following 'SELECT' [#2118 state:resolved]" This reverts commit 4851ca9e13a4317342df02ae25b1929340523f7a. The tests do not pass for postgresql.
* Generate proper :counter_sql from :finder_sql when there is a newline ↵Patrick Joyce2009-06-211-1/+13
| | | | | | character immediately following 'SELECT' [#2118 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Implement #many? for NamedScope and AssociationCollection using #size [#1500 ↵Chris Kampmeier2009-05-171-0/+9
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Providing support for :inverse_of as an option to associations.Murray Steele2009-05-041-2/+6
| | | | | | | | | | | | | | | | | | | | | | You can now add an :inverse_of option to has_one, has_many and belongs_to associations. This is best described with an example: class Man < ActiveRecord::Base has_one :face, :inverse_of => :man end class Face < ActiveRecord::Base belongs_to :man, :inverse_of => :face end m = Man.first f = m.face Without :inverse_of m and f.man would be different instances of the same object (f.man being pulled from the database again). With these new :inverse_of options m and f.man are the same in memory instance. Currently :inverse_of supports has_one and has_many (but not the :through variants) associations. It also supplies inverse support for belongs_to associations where the inverse is a has_one and it's not a polymorphic. Signed-off-by: Murray Steele <muz@h-lame.com> Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Merge docrailsPratik Naik2009-03-161-5/+9
|
* Ensure AutosaveAssociation runs remove callbacks [#2146 state:resolved]Luca Guidi2009-03-121-19/+32
| | | | | Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com> Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Add tests for AssociationCollection#find_each and ↵Pratik Naik2009-03-111-1/+1
| | | | AssociationCollection#find_in_batches
* Fix preloading of has_one :through associations on belongs_to [#1507 ↵Matt Jones2008-12-181-1/+5
| | | | | | state:resolved] Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
* Revert "Fix: counter_cache should decrement on deleting associated records."Jeremy Kemper2008-12-101-3/+0
| | | | | | [#1196 state:open] This reverts commit 05f2183747c8e75c9e8bbaadb9573b4bdf41ecfc.
* Fix: counter_cache should decrement on deleting associated records.Emilio Tagua2008-12-101-0/+3
| | | | | | [#1195 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Merge with docrails. Also add a rake task to generate guides in your rails ↵Pratik Naik2008-10-211-1/+7
| | | | | | | | application : rake doc:guides The rake task will generate guides inside doc/guides directory of your application. Open index.html to browse.
* Ensure association proxy responds to private class methods defined in ↵Pratik Naik2008-10-161-2/+2
| | | | associated class. [#1083]
* Allow class methods to be sent (via #send) to association proxy (fix for bug ↵Ian White2008-10-161-0/+4
| | | | | | introduced by 691aa20) [#1083] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Make AssociationCollection start transactions in the correct database.Hongli Lai (Phusion)2008-09-231-4/+19
| | | | | | | | | | AssociationCollection now starts transactions by calling AssociationCollection#transaction instead of @owner.transaction or @reflection.klass.transaction. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#1081 state:committed]
* Association#first and last should not load the association if not needed. ↵Jan De Poorter2008-09-221-3/+4
| | | | | | [#1091 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* When counting grouped records the target should be loaded to return a valid ↵miloops2008-09-151-0/+2
| | | | | | | | | groups count result. Without this change count_records will group for the count in the query and return erroneous results. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#937 state:committed]
* Revert "Add :accessible option to Associations for allowing mass assignments ↵Pratik Naik2008-09-101-6/+0
| | | | | | | | | | | | using hash. [#474 state:resolved]" This reverts commit e0750d6a5c7f621e4ca12205137c0b135cab444a. Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/association_collection.rb
* Add special AssociationReflection methods for creating association objects, ↵Hongli Lai (Phusion)2008-09-091-4/+6
| | | | | | | | and modify the code base to use those methods instead of creating association objects directly. This allows plugins to hook into association object creation behavior. [#986 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Merge docrailsPratik Naik2008-09-031-5/+31
|
* Refactored AssociationCollection#count for uniformity and Ruby 1.8.7 support.Ernie Miller2008-08-281-0/+29
| | | | | | [#831 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Fixed AssociationCollection#<< resulting in unexpected values in @target ↵Ernie Miller2008-08-081-1/+1
| | | | | | when :uniq => true Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Add :accessible option to Associations for allowing mass assignments using ↵David Dollar2008-07-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | hash. [#474 state:resolved] Allows nested Hashes (i.e. from nested forms) to hydrate the appropriate ActiveRecord models. class Post < ActiveRecord::Base belongs_to :author, :accessible => true has_many :comments, :accessible => true end post = Post.create({ :title => 'Accessible Attributes', :author => { :name => 'David Dollar' }, :comments => [ { :body => 'First Post!' }, { :body => 'Nested Hashes are great!' } ] }) post.comments << { :body => 'Another Comment' } Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Add block syntax to HasManyAssociation#build. [#502 state:resolve]Jason Dew2008-07-141-3/+6
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Remove some Symbol#to_proc usage in runtime code. [#484 state:resolved]Cheah Chu Yeow2008-07-091-1/+1
|