aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/association_collection.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Ensure AssociationCollection#size considers all unsaved record. [#305 ↵Pratik Naik2008-07-021-1/+1
| | | | | | state:resolved] [sds] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Merge docrails.Pratik Naik2008-05-251-2/+2
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Create through associations can now work with blocks.Ryan Bates2008-05-241-2/+8
| | | | | | Signed-off-by: Michael Koziarski <michael@koziarski.com> [#248 state:resolved]
* Add first/last methods to associations/named_scope. [#226 state:resolved]Ryan Bates2008-05-201-1/+24
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Fix include? on has_many collections with finder_sql to fall back to Array ↵Joshua Bates2008-04-231-0/+1
| | | | | | include? rather than try to use SQL. [#18 state:resolved]
* Remove duplicate code from associations. [Pratik]Pratik Naik2008-04-061-13/+55
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9231 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Refactor HasManyThroughAssociation to inherit from HasManyAssociation. ↵Pratik Naik2008-04-061-1/+15
| | | | | | Association callbacks and <association>_ids= now work with hm:t. Closes #11516 [rubyruy] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9230 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Ensure HABTM#create and HABTM#build do not load entire association. [Pratik]Pratik Naik2008-04-051-0/+19
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9229 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Replaced callback method evaluation in AssociationCollection class to use ↵Josh Peek2008-04-041-13/+2
| | | | | | ActiveSupport::Callbacks. Modified ActiveSupport::Callbacks::Callback#call to accept multiple arguments. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9225 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add efficient #include? to AssociationCollection (for has_many/has_many ↵Rick Olson2008-04-011-0/+5
| | | | | | :through/habtm). [stopdropandrew] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9200 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Merge the has_finder gem, renamed as 'named_scope'. Closes #11404 [nkallen]Rick Olson2008-03-241-3/+5
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9084 5ecf4fe2-1ee6-0310-87b1-e25e094e27de