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
Yasuo Honda 945aa87466 Address "NameError: Rails couldn't find a valid model for Club association"
This commit addresses CI failure of Active Record isolation tests.
https://buildkite.com/rails/rails/builds/79936

Follow up #41392

* Steps to reproduce
```ruby
$ cd activerecord
$ bin/test test/cases/associations/belongs_to_associations_test.rb test/cases/associations/has_many_associations_test.rb test/cases/associations/has_many_through_disable_joins_associations_test.rb test/cases/associations/has_one_associations_test.rb test/cases/connection_adapters/schema_cache_test.rb test/cases/inheritance_test.rb test/cases/migration_test.rb test/cases/store_test.rb test/cases/strict_loading_test.rb
```

Since the entire output is too long, here is the minimum case fixed by
this commit.

```ruby
$ cd activerecord
$ bin/test test/cases/associations/belongs_to_associations_test.rb:38
Using sqlite3
Run options: --seed 34180

E

Error:
BelongsToAssociationsTest#test_belongs_to:
NameError: Rails couldn't find a valid model for Club association. Please provide the :class_name option on the association declaration. If :class_name is already provided, make sure it's an ActiveRecord::Base subclass.
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:431:in `rescue in compute_class'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:422:in `compute_class'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:372:in `klass'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:722:in `association_primary_key'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:727:in `join_primary_key'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixture_set/table_row.rb:150:in `block in resolve_sti_reflections'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixture_set/table_row.rb:138:in `each_value'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixture_set/table_row.rb:138:in `resolve_sti_reflections'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixture_set/table_row.rb:92:in `fill_row_model_attributes'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixture_set/table_row.rb:70:in `initialize'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixture_set/table_rows.rb:36:in `new'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixture_set/table_rows.rb:36:in `block in build_table_rows_from'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixture_set/table_rows.rb:35:in `each'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixture_set/table_rows.rb:35:in `map'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixture_set/table_rows.rb:35:in `build_table_rows_from'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixture_set/table_rows.rb:18:in `initialize'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixtures.rb:692:in `new'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixtures.rb:692:in `table_rows'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixtures.rb:633:in `block (2 levels) in insert'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixtures.rb:632:in `each'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixtures.rb:632:in `block in insert'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixtures.rb:629:in `each'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixtures.rb:629:in `insert'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixtures.rb:615:in `read_and_insert'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/fixtures.rb:567:in `create_fixtures'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/test_fixtures.rb:268:in `load_fixtures'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/test_fixtures.rb:122:in `setup_fixtures'
    /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/test_fixtures.rb:10:in `before_setup'

bin/test test/cases/associations/belongs_to_associations_test.rb:38

Finished in 0.083668s, 11.9520 runs/s, 0.0000 assertions/s.
1 runs, 0 assertions, 0 failures, 1 errors, 0 skips
$
```
2021-08-05 12:40:19 +09:00
..
belongs_to_associations_test.rb Address "NameError: Rails couldn't find a valid model for Club association" 2021-08-05 12:40:19 +09:00
bidirectional_destroy_dependencies_test.rb
callbacks_test.rb
cascaded_eager_loading_test.rb Avoid stack level too deep in predicate builder 2021-02-11 11:32:20 -05:00
eager_load_includes_full_sti_class_test.rb Support storing demodulized class name for polymorphic type 2020-08-23 16:04:29 +09:00
eager_load_nested_include_test.rb chore: fix grammar, spelling and minor whitespace fix 2021-04-13 21:35:50 +10:00
eager_singularization_test.rb
eager_test.rb Clean up checks to see if DidYouMean is defined 2021-07-04 13:43:50 +02:00
extension_test.rb
has_and_belongs_to_many_associations_test.rb Deprecate partial_writes in favor of partial_inserts and partial_updates 2021-06-02 15:04:08 +02:00
has_many_associations_test.rb Address "NameError: Rails couldn't find a valid model for Club association" 2021-08-05 12:40:19 +09:00
has_many_through_associations_test.rb chore: fix spelling change favourite to the more used favorite 2021-04-12 12:35:12 +10:00
has_many_through_disable_joins_associations_test.rb Address "NameError: Rails couldn't find a valid model for Club association" 2021-08-05 12:40:19 +09:00
has_one_associations_test.rb Address "NameError: Rails couldn't find a valid model for Club association" 2021-08-05 12:40:19 +09:00
has_one_through_associations_test.rb chore: fix spelling change favourite to the more used favorite 2021-04-12 12:35:12 +10:00
has_one_through_disable_joins_associations_test.rb Fix disable_joins when using an enum STI type 2021-06-24 14:30:00 -04:00
inner_join_association_test.rb Address intermittent CI failure due to non-determined sort order 2021-02-21 14:09:18 +09:00
inverse_associations_test.rb Clean up checks to see if DidYouMean is defined 2021-07-04 13:43:50 +02:00
join_model_test.rb Clean up checks to see if DidYouMean is defined 2021-07-04 13:43:50 +02:00
left_outer_join_association_test.rb Address intermittent CI failure due to non-determined sort order 2021-02-21 14:09:18 +09:00
nested_through_associations_test.rb Add option for default_scope to run on all queries 2020-12-01 11:15:08 -05:00
required_test.rb