aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/has_many_association.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* Split AssociationProxy into an Association class (and subclasses) which ↵Jon Leighton2011-02-181-7/+5
| | | | manages the association, and a CollectionProxy class which is *only* a proxy. Singular associations no longer have a proxy. See CHANGELOG for more.
* Get rid of AssociationCollection#save_recordJon Leighton2011-02-141-2/+2
|
* Refactor the implementations of AssociatioCollection#delete and #destroy to ↵Jon Leighton2011-02-071-1/+1
| | | | be more consistent with each other, and to stop passing blocks around, thus making the execution easier to follow.
* Correctly update counter caches on deletion for has_many :through [#2824 ↵Jon Leighton2011-02-071-15/+39
| | | | state:resolved]. Also fixed a bunch of other counter cache bugs in the process, as once I fixed this one others started appearing like nobody's business.
* Make record.association.destroy(*records) on habtm and hm:t only delete ↵Jon Leighton2011-02-071-11/+11
| | | | records in the join table. This is to make the destroy method more consistent across the different types of associations. For more details see the CHANGELOG entry.
* Rename AssociationProxy#loaded to loaded! as it mutates the associationJon Leighton2011-01-301-1/+1
|
* Let's be less blasé about method visibility on association proxiesJon Leighton2011-01-301-5/+8
|
* Construct an actual ActiveRecord::Relation object for the association scope, ↵Jon Leighton2011-01-071-3/+1
| | | | rather than a hash which is passed to apply_finder_options. This allows more flexibility in how the scope is created, for example because scope.where(a, b) and scope.where(a).where(b) mean different things.
* Create the association scope directly rather than going through with_scopeJon Leighton2011-01-031-1/+1
|
* Use the association directly in other places tooJon Leighton2011-01-031-4/+2
|
* Let AssociationCollection#find use #scoped to do its finding. Note that I am ↵Jon Leighton2011-01-031-10/+0
| | | | removing test_polymorphic_has_many_going_through_join_model_with_disabled_include, since this specifies different behaviour for an association than for a regular scope. It seems reasonable to expect scopes and association proxies to behave in roughly the same way rather than having subtle differences.
* Rename AssociationReflection#primary_key_name to foreign_key, since the ↵Jon Leighton2010-12-311-1/+1
| | | | options key which it relates to is :foreign_key
* And owner_quoted_id can go tooJon Leighton2010-12-311-8/+0
|
* Refactor we_can_set_the_inverse_on_this? to use a less bizarre name amongst ↵Jon Leighton2010-12-261-4/+0
| | | | other things
* Associations: DRY up the code which is generating conditions, and make it ↵Jon Leighton2010-12-261-16/+2
| | | | all use arel rather than SQL strings
* Remove target_obsolete? which is not called from anywhereJon Leighton2010-12-261-4/+0
|
* Avoid Symbol#to_proc for performance reasons in Ruby 1.8Jon Leighton2010-12-201-3/+3
|
* has_many associations with :dependent => :delete_all should update the ↵Jon Leighton2010-12-201-1/+3
| | | | counter cache when deleting records
* Refactor delete_records in HasManyAssociationJon Leighton2010-12-201-7/+8
|
* Specify insert_record with NotImplementedError in AssociationCollection, to ↵Jon Leighton2010-12-201-1/+1
| | | | indicate that subclasses should implement it. Also add save_record to reduce duplication.
* removing more calls to deprecated methodsAaron Patterson2010-12-021-2/+3
|
* reduce method callsAaron Patterson2010-11-241-1/+1
|
* removing ternaryAaron Patterson2010-11-231-1/+1
|
* Refactor && simplify count_records.Emilio Tagua2010-11-231-5/+1
|
* Remove explicit return and avoid creating local var.Emilio Tagua2010-11-241-2/+1
|
* Remove explicit return.Emilio Tagua2010-11-241-1/+1
|
* Refactoring: replace the mix of variables like @finder_sql, @counter_sql, ↵Jon Leighton2010-10-301-32/+24
| | | | etc with just a single scope hash (created on initialization of the proxy). This is now used consistently across all associations. Therefore, all you have to do to ensure finding/counting etc is done correctly is implement the scope correctly.
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-4/+4
| | | | 's/[ \t]*$//' -i {} \;)
* removing references to arel constantsAaron Patterson2010-08-131-1/+1
|
* avoiding symbol to proc againAaron Patterson2010-08-131-1/+1
|
* standarizes the use of the article "an" for "SQL" and "SQLite"Xavier Noria2010-08-051-1/+1
|
* splitting a really long line into multiple lines which is easy on eyesNeeraj Singh2010-06-291-1/+5
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Adds title to activerecord/lib/active_record/associations/*Rizwan Reza2010-06-161-0/+1
|
* clean up more warnings, remove unnecessary methods, fix eval line numbers. ↵Aaron Patterson2010-03-161-0/+4
| | | | | | [#4193 state:resolved] Signed-off-by: wycats <wycats@gmail.com>
* save(false) is gone, use save(:validate => false) instead.José Valim2010-01-171-1/+1
|
* Use Arel::Table instead of ActiveRecord::Relation from HABTM and ↵Pratik Naik2010-01-011-1/+1
| | | | has_many#delete_records
* Rename Model.conditions and relation.conditions to .wherePratik Naik2009-12-261-1/+1
|
* Revert "Split arel_table into method to get a relation and another to ↵Jeremy Kemper2009-11-131-1/+1
| | | | | | memoize the default relation." This reverts commit bd51790895fc75a3b4e19e8dd7aa6dc389d77068.
* Split arel_table into method to get a relation and another to memoize the ↵Jeremy Kemper2009-11-131-1/+1
| | | | default relation.
* Arel::In -> Arel::Predicates::InJeremy Kemper2009-11-021-1/+1
|
* has_many nullify associations keys using ARel.Emilio Tagua2009-08-181-9/+9
|
* Fix that counter_cache breaks with has_many :dependent => :nullify.Gabe da Silveira2009-08-091-0/+1
| | | | | | [#1196 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Revert "Revert "Generate proper :counter_sql from :finder_sql when there is ↵Pratik Naik2009-07-011-9/+1
| | | | | | | | | 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-1/+9
| | | | | | | | 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-9/+1
| | | | | | character immediately following 'SELECT' [#2118 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Providing support for :inverse_of as an option to associations.Murray Steele2009-05-041-0/+5
| | | | | | | | | | | | | | | | | | | | | | 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>
* Fixed that autosave should validate associations even if master is invalid ↵David Heinemeier Hansson2009-02-271-2/+2
| | | | [#1930 status:committed]
* Merge with docrails. Also add a rake task to generate guides in your rails ↵Pratik Naik2008-10-211-0/+1
| | | | | | | | application : rake doc:guides The rake task will generate guides inside doc/guides directory of your application. Open index.html to browse.
* Update the documentation to reflect the change handling :group earlierMichael Koziarski2008-09-161-1/+4
|
* Merge docrailsPratik Naik2008-09-031-0/+14
|