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/fixtures
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
..
admin Fix backward compatibility with stored Hash values. Wrap coders to convert serialized values to indifferent access. 2012-05-30 23:21:57 -07:00
all deprecating CSV fixture support 2011-05-10 11:08:18 -07:00
categories Add missing fixtures for #3937. 2006-02-28 17:46:16 +00:00
naked
reserved_words Improve the derivation of HABTM assocation join table names 2012-06-22 06:27:11 +01:00
.gitignore Merge branch 'ar-test-cleanup' of git://git.geeksomnia.com/rails 2008-01-21 17:20:51 +00:00
accounts.yml Fix has_one with foreign_key and primary_key association bug which caused the associated object being lost when saving the owner. [#1756 state:resolved] 2009-09-12 16:03:32 +02:00
author_addresses.yml Add missing author_addresses.yml fixture. Closes #10592. 2008-01-21 17:21:12 +00:00
author_favorites.yml add self referential has_many :through example [Rick] 2006-03-21 01:07:16 +00:00
authors.yml Support the :primary_key option on a through reflection in a nested through association 2010-10-19 16:13:06 +01:00
binaries.yml fixing invalid yaml [#4424 state:resolved] 2010-04-17 00:14:23 -04:00
books.yml Initial nested_has_many_through support [#1152] 2010-09-26 22:25:25 +10:00
cars.yml order should always be concatenated. 2010-09-05 08:13:42 -03:00
categories.yml First bit of support for habtm in through assocs - test_has_many_through_has_many_with_has_and_belongs_to_many_source_reflection now passes 2010-10-13 01:29:09 +01:00
categories_ordered.yml fixing 1.8 support for new fixture tests 2011-05-23 15:06:13 -07:00
categories_posts.yml First bit of support for habtm in through assocs - test_has_many_through_has_many_with_has_and_belongs_to_many_source_reflection now passes 2010-10-13 01:29:09 +01:00
categorizations.yml Added test_has_many_through_has_many_with_has_many_through_habtm_source_reflection and make it pass 2010-10-14 12:59:16 +01:00
clubs.yml Add test_has_one_through_has_one_through_with_belongs_to_source_reflection 2010-10-14 13:44:32 +01:00
collections.yml Refactor compute_type to handle situations where the correct class is already loaded 2010-04-12 21:31:20 -07:00
colleges.yml added test for #3732 2012-02-10 17:35:22 -05:00
comments.yml Add some tests for functionality in JoinAssociation which already exists but was previously untested 2010-10-13 08:24:19 -07:00
companies.yml Associations: DRY up the code which is generating conditions, and make it all use arel rather than SQL strings 2010-12-26 19:38:04 +00:00
computers.yml
courses.yml added test for #3732 2012-02-10 17:35:22 -05:00
customers.yml Added :constructor and :converter options to composed_of and deprecated the conversion block 2008-09-10 18:28:47 +02:00
dashboards.yml If a has_many goes :through a belongs_to, and the foreign key of the belongs_to changes, then the has_many should be considered stale. 2010-12-23 15:19:18 -08:00
developers.yml Replaced all 'for' loops with Enumerable#each 2012-01-30 03:15:49 +08:00
developers_projects.yml fix test_find_in_association_with_options test, tweak other tests affected by developer/project addition 2006-03-16 03:24:40 +00:00
dog_lovers.yml Fix bug where reset_counters resets the wrong counter cache. 2012-01-16 19:06:45 -08:00
dogs.yml Fix bug where reset_counters resets the wrong counter cache. 2012-01-16 19:06:45 -08:00
edges.yml Revert "Revert "Assert primary key does not exist in habtm when the association is defined, instead of doing that everytime a record is inserted."" 2009-11-23 10:42:32 -08:00
entrants.yml
essays.yml Support for :primary_key option on the source reflection of a through association, where the source is a has_one or has_many 2010-10-19 14:14:06 +01:00
faces.yml Add inverse polymorphic association support. [#3520 state:resolved] 2009-12-28 15:12:13 +01:00
fk_test_has_fk.yml
fk_test_has_pk.yml
funny_jokes.yml Fixtures: correct escaping of \n and \r. Closes #5859. 2006-08-24 01:50:24 +00:00
interests.yml Add inverse polymorphic association support. [#3520 state:resolved] 2009-12-28 15:12:13 +01:00
items.yml Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) 2010-08-14 04:12:33 -03:00
jobs.yml Ensure table names are quoted by the association preloading code. 2008-04-26 12:14:50 +12:00
legacy_things.yml allow the 'lock_version' column to be configured with set_locking_column. Closes #3402 2006-01-14 09:36:52 +00:00
mateys.yml Namespace Fixtures in ActiveRecord 2011-05-07 14:20:51 -06:00
member_details.yml Adding test_has_many_through_has_one_with_has_many_through_source_reflection and modifying ThroughAssociationScope to make it work correctly. 2010-10-12 17:27:10 +01:00
member_types.yml Fix preloading of has_one :through associations on belongs_to [#1507 state:resolved] 2008-12-18 19:19:36 +00:00
members.yml If a has_many goes :through a belongs_to, and the foreign key of the belongs_to changes, then the has_many should be considered stale. 2010-12-23 15:19:18 -08:00
memberships.yml Don't use select() values from the join model of a through association. Fixes #508. 2011-05-11 08:56:01 +01:00
men.yml Providing support for :inverse_of as an option to associations. 2009-05-04 15:27:39 -07:00
minimalistics.yml Missed the add 2007-10-06 01:03:19 +00:00
minivans.yml update_attribute should not update readonly attributes 2010-07-21 14:55:57 +02:00
mixed_case_monkeys.yml Consistently quote primary key column names. Closes #7763. 2007-03-09 03:23:37 +00:00
mixins.yml Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) 2010-08-14 04:12:33 -03:00
movies.yml
organizations.yml Revert "Fixed bug with polymorphic has_one :as pointing to an STI record" 2009-05-11 12:20:54 -07:00
other_topics.yml Fix a fixtures test case with table prefix/suffix 2011-12-27 02:17:31 +01:00
owners.yml Support for :primary_key option on the source reflection of a through association, where the source is a has_one or has_many 2010-10-19 14:14:06 +01:00
parrots.yml properly reference yml alias nodes 2011-05-24 11:18:28 +02:00
parrots_pirates.yml Namespace Fixtures in ActiveRecord 2011-05-07 14:20:51 -06:00
people.yml Fixed limited eager loading associations with numbers in the name [#2668 state:resolved] 2009-05-18 13:56:17 +02:00
peoples_treasures.yml Tests for removing a HABTM association when optimistic locking is enabled. 2012-03-07 23:56:23 -05:00
pets.yml Fixed preloading belongs_to associations which reference a custom foreign key. References #9640. 2008-01-31 07:50:15 +00:00
pirates.yml Quote these dates to prevent intermittent test failure. Suppose local time is 00:50 GMT+1. Without the quoting, the YAML parser would parse this as 00:50 UTC, into the local time of 01:50 GMT+1. Then, it would get written into the database in local time as 01:50. When it came back out the UTC date from the database and the UTC date of two weeks ago would be compared. The former would be 23:50, and the latter would be 00:50, so the two dates would differ, causing the assertion to fail. Quoting it prevents the YAML parser from getting involved. 2011-08-04 00:38:27 +01:00
posts.yml Merge branch 'master' into nested_has_many_through 2011-03-04 09:30:27 +00:00
price_estimates.yml Fix has_many :through a polymorphic has_many. Closes #10529 [Aleksey Kondratenko] 2008-02-02 03:27:31 +00:00
products.yml Refactor compute_type to handle situations where the correct class is already loaded 2010-04-12 21:31:20 -07:00
projects.yml
randomly_named_a9.yml Test fixtures with custom model and table names 2011-12-30 10:34:01 +01:00
ratings.yml Add support for nested through associations in JoinAssociation. Hence Foo.joins(:bar) will work for through associations. There is some duplicated code now, which will be refactored. 2010-10-09 22:00:33 +01:00
readers.yml Make dynamic finders respect the :include on HasManyThrough associations. Closes #10998. [cpytel] 2008-02-18 00:14:54 +00:00
references.yml Ensure table names are quoted by the association preloading code. 2008-04-26 12:14:50 +12:00
ships.yml has_one should always remove the old record (properly), even if not saving the new record, so we don't get the database into a pickle 2011-01-11 13:45:06 -08:00
speedometers.yml If a has_many goes :through a belongs_to, and the foreign key of the belongs_to changes, then the has_many should be considered stale. 2010-12-23 15:19:18 -08:00
sponsors.yml If a has_many goes :through a belongs_to, and the foreign key of the belongs_to changes, then the has_many should be considered stale. 2010-12-23 15:19:18 -08:00
string_key_objects.yml Don't quote ID's as Arel will quote them -- follow same conventions as the delete method. 2011-05-08 18:37:28 +01:00
subscribers.yml IdentityMap - Tests for IM 2010-11-19 19:03:56 -03:00
subscriptions.yml test and fix collection_singular_ids= with string primary keys [#5125 state:resolved] 2010-08-02 16:41:20 +02:00
taggings.yml Add a test for STI on the through where the through is nested, and change the code which support this 2011-03-05 20:10:24 +00:00
tags.yml Properly support conditions on any of the reflections involved in a nested through association 2010-10-19 00:27:40 +01:00
tasks.yml restores the API docs of AR::Fixtures, made a quick pass over them, revises link in fixture template [closes #2840] 2011-09-03 15:20:30 -07:00
teapots.yml Fixtures support for ActiveRecord::Model 2011-12-24 11:08:15 +00:00
topics.yml Test for concatenated orders added 2010-06-26 00:59:11 +02:00
toys.yml Ensure has_many :through works with changed primary keys [#736 state:resolved] 2009-03-09 13:43:28 +00:00
traffic_lights.yml Make serialized fixtures work again 2010-12-29 16:15:45 +00:00
treasures.yml Add 'foxy' support for fixtures of polymorphic associations. Closes #10183 [jbarnette, David Lowenfels] 2007-11-20 21:53:22 +00:00
variants.yml Refactor compute_type to handle situations where the correct class is already loaded 2010-04-12 21:31:20 -07:00
vertices.yml Included associations: go deep. 2006-08-16 18:10:52 +00:00
warehouse-things.yml More thoroughly quote table names. Exposes some issues with sqlite2 adapter. Closes #10698. 2008-01-05 14:58:28 +00:00
zines.yml Providing support for :inverse_of as an option to associations. 2009-05-04 15:27:39 -07:00