This project is archived and is in readonly mode.

#45 ✓resolved
Frederick Cheung

Association Preload should quote table names

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

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

Comments and changes to this ticket

  • Michael Koziarski

    Michael Koziarski April 25th, 2008 @ 08:40 AM

    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'

  • Frederick Cheung

    Frederick Cheung April 25th, 2008 @ 09:02 AM

    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

  • Frederick Cheung

    Frederick Cheung April 25th, 2008 @ 10:20 AM

    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 ?

  • Frederick Cheung

    Frederick Cheung April 25th, 2008 @ 11:33 PM

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

  • Repository

    Repository April 26th, 2008 @ 01:16 AM

    • 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...

  • Michael Koziarski

    Michael Koziarski April 26th, 2008 @ 01:16 AM

    • State changed from “resolved” to “new”

    yeah, that was it.

    Man that was an awesome error ;)

  • Michael Koziarski

    Michael Koziarski April 26th, 2008 @ 01:16 AM

    • State changed from “new” to “resolved”

    ugh, closing again.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages