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/cases/associations
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
..
belongs_to_associations_test.rb quarantine deprecated tests 2012-05-18 14:46:54 +01:00
callbacks_test.rb please use ruby -I lib:test path/to/test.rb, or export RUBY_OPT 2011-06-06 15:47:13 -07:00
cascaded_eager_loading_test.rb find and replace deprecated keys 2012-04-27 12:37:21 +01:00
eager_load_includes_full_sti_class_test.rb fix #scoped deprecations 2012-04-26 13:29:48 +01:00
eager_load_nested_include_test.rb Remove unused assignments from activerecord tests 2012-04-29 10:02:58 -07:00
eager_singularization_test.rb find and replace deprecated keys 2012-04-27 12:37:21 +01:00
eager_test.rb No need to cache table metadata in advance now that #6683 was merged. 2012-06-11 18:13:14 -03:00
extension_test.rb No Ruby 1.8 stuff. No more checks in code. 2011-12-21 12:20:12 +05:30
habtm_join_table_test.rb please use ruby -I lib:test path/to/test.rb, or export RUBY_OPT 2011-06-06 15:47:13 -07:00
has_and_belongs_to_many_associations_test.rb Improve the derivation of HABTM assocation join table names 2012-06-22 06:27:11 +01:00
has_many_associations_test.rb No need to cache table metadata in advance now that #6683 was merged. 2012-06-11 18:13:14 -03:00
has_many_through_associations_test.rb remove calls to find(:first), find(:last) and find(:all) 2012-04-26 18:32:55 +01:00
has_one_associations_test.rb remove deprecated calls 2012-04-27 14:28:36 +01:00
has_one_through_associations_test.rb remove deprecated calls 2012-04-27 14:28:36 +01:00
inner_join_association_test.rb remove deprecate #calculate calls 2012-04-26 18:04:41 +01:00
inverse_associations_test.rb find and replace deprecated keys 2012-04-27 12:37:21 +01:00
join_model_test.rb Add tests to delete by fixnum or string id with has many through associations 2012-05-28 22:31:41 -05:00
nested_through_associations_test.rb Deprecate inferred JOINs with includes + SQL snippets. 2012-01-16 21:32:12 +00:00