aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/preloader/has_and_belongs_to_many.rb
Commit message (Collapse)AuthorAgeFilesLines
* 1. Change from each to each_value since we did not use keyVipul A M2013-03-191-1/+1
| | | | 2. drop assignment of value to sum in test
* Improve the derivation of HABTM assocation join table namesAndrew White2012-06-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve the derivation of HABTM join table name to take account of nesting. It now takes the table names of the two models, sorts them lexically and then joins them, stripping any common prefix from the second table name. Some examples: Top level models (Category <=> Product) Old: categories_products New: categories_products Top level models with a global table_name_prefix (Category <=> Product) Old: site_categories_products New: site_categories_products Nested models in a module without a table_name_prefix method (Admin::Category <=> Admin::Product) Old: categories_products New: categories_products Nested models in a module with a table_name_prefix method (Admin::Category <=> Admin::Product) Old: categories_products New: admin_categories_products Nested models in a parent model (Catalog::Category <=> Catalog::Product) Old: categories_products New: catalog_categories_products Nested models in different parent models (Catalog::Category <=> Content::Page) Old: categories_pages New: catalog_categories_content_pages Also as part of this commit the validity checks for HABTM assocations have been moved to ActiveRecord::Reflection One side effect of this is to move when the exceptions are raised from the point of declaration to when the association is built. This is consistant with other association validity checks.
* Make it the responsibility of the connection to hold onto an ARel visitor ↵Jon Leighton2011-08-081-1/+1
| | | | for generating SQL. This improves the code architecture generally, and solves some problems with marshalling. Adapter authors please take note: you now need to define an Adapter.visitor_for method, but it degrades gracefully with a deprecation warning for now.
* When preloading has_and_belongs_to_many associations, we should only ↵Jon Leighton2011-03-041-2/+4
| | | | instantiate one AR object per actual record in the database. (Even when IM is off.)
* Rewrote AssociationPreload.Jon Leighton2011-02-281-0/+58