Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Association Preload should quote table names

#45

As per the FIXMEs in the source, it wasn't quoting table names. Naughty.

Reported by Frederick Cheung · April 24th, 2008 @ 10:43 AM

State: resolved
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Michael Koziarski
    Michael Koziarski

    Applying this causes stacks of errors:

    1418 tests, 4864 assertions, 2 failures, 70 errors

    Most of them are:

    test_eager_with_invalid_association_reference(EagerAssociationTest):

    IndexError: string not matched

    ./test/cases/../../lib/active_record/fixtures.rb:621:in `[]='

    ./test/cases/../../lib/active_record/fixtures.rb:621:in `insert_fixtures'

    ./test/cases/../../lib/active_record/fixtures.rb:604:in `each'

    ./test/cases/../../lib/active_record/fixtures.rb:604:in `insert_fixtures'

    ./test/cases/../../lib/active_record/fixtures.rb:575:in `each'

    ./test/cases/../../lib/active_record/fixtures.rb:575:in `insert_fixtures'

    ./test/cases/../../lib/active_record/fixtures.rb:519:in `create_fixtures'

    ./test/cases/../../lib/active_record/fixtures.rb:519:in `each'

    ./test/cases/../../lib/active_record/fixtures.rb:519:in `create_fixtures'

    ./test/cases/../../lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'

    ./test/cases/../../lib/active_record/fixtures.rb:517:in `create_fixtures'

    ./test/cases/../../lib/active_record/connection_adapters/mysql_adapter.rb:252:in `disable_referential_integrity'

    ./test/cases/../../lib/active_record/fixtures.rb:508:in `create_fixtures'

    ./test/cases/../../lib/active_record/base.rb:1240:in `silence'

    ./test/cases/../../lib/active_record/fixtures.rb:507:in `create_fixtures'

    ./test/cases/../../lib/active_record/fixtures.rb:962:in `load_fixtures'

    ./test/cases/../../lib/active_record/fixtures.rb:928:in `setup_fixtures'

    ./test/cases/../../lib/../../activesupport/lib/active_support/callbacks.rb:173:in `send'

    ./test/cases/../../lib/../../activesupport/lib/active_support/callbacks.rb:173:in `evaluate_method'

    ./test/cases/../../lib/../../activesupport/lib/active_support/callbacks.rb:161:in `call'

    ./test/cases/../../lib/../../activesupport/lib/active_support/callbacks.rb:90:in `run'

    ./test/cases/../../lib/../../activesupport/lib/active_support/callbacks.rb:90:in `each'

    ./test/cases/../../lib/../../activesupport/lib/active_support/callbacks.rb:90:in `send'

    ./test/cases/../../lib/../../activesupport/lib/active_support/callbacks.rb:90:in `run'

    ./test/cases/../../lib/../../activesupport/lib/active_support/callbacks.rb:272:in `run_callbacks'

    ./test/cases/../../lib/../../activesupport/lib/active_support/testing/setup_and_teardown.rb:57:in `run'

    April 25th, 2008 @ 08:40 AM

  2. Frederick Cheung
    Frederick Cheung

    Wow, that obviously didn't happen when I ran the tests. I tried again applying the patch to a clean checkout of rails and it still looks ok (I cleared out the databases used by the unit tests in between).

    It obviously doesn't like one of the fixture files I added, but I'm not sure I understand why since they're really quite ordinary. A quick google implies that IndexError: string not matched implies that you tried to use a string like a hash, but I don't understand how that could happen especially as I can't reproduce it

    April 25th, 2008 @ 09:02 AM

  3. Frederick Cheung
    Frederick Cheung

    I've had a bit of a fiddle and I can reproduce this if i edit jobs.yml (added in this patch) so that the last line reads

    magician:
      id:
    

    instead of

    magician:
      id: 3
    

    I can see now that that file didn't have a newline at the end, so perhaps I botched things up there a bit ? Does jobs.yml look right ?

    April 25th, 2008 @ 10:20 AM

  4. Frederick Cheung
    Frederick Cheung

    I think i've fixed the files with no new lines at the end. This should make everything hunky-dory

    April 25th, 2008 @ 11:33 PM

  5. Repository
    Repository
    • State changed from new to resolved

    (from [44d214235271cb6d2af1c327d592a3010e1ced3e]) Ensure table names are quoted by the association preloading code.

    [#45 state:resolved]

    Signed-off-by: Michael Koziarski

    http://github.com/rails/rails/co...

    April 26th, 2008 @ 01:16 AM

  6. Michael Koziarski
    Michael Koziarski
    • State changed from resolved to new

    yeah, that was it.

    Man that was an awesome error ;)

    April 26th, 2008 @ 01:16 AM

  7. Michael Koziarski
    Michael Koziarski
    • State changed from new to resolved

    ugh, closing again.

    April 26th, 2008 @ 01:16 AM