1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/schema
Andrew White 46492949b8 Improve the derivation of HABTM assocation join table names
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.
2012-06-22 06:27:11 +01:00
..
mysql2_specific_schema.rb Fix type_to_sql with text and limit on mysql/mysql2. Fix GH #3931. 2012-02-26 00:35:58 +09:00
mysql_specific_schema.rb Fix type_to_sql with text and limit on mysql/mysql2. Fix GH #3931. 2012-02-26 00:35:58 +09:00
oracle_specific_schema.rb
postgresql_specific_schema.rb Add uuid type support to PostgreSQL adapter 2012-06-14 17:44:51 +04:00
schema.rb Improve the derivation of HABTM assocation join table names 2012-06-22 06:27:11 +01:00
sqlite_specific_schema.rb mispelling errors in render_text_test.rb and sqlite_specific_schema 2012-05-12 13:19:28 +02:00