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.

Fixture columns should be quoted by the appropriate connection

#3104

AR::Fixtures.create_fixtures(...) { Custom.connection } will quote columns using AR::Base.connection rather than the custom connection. This is a problem when AR::Base.connection and Custom.connection use different adapters that perform quoting differently, as is the case with mysql and sqlite3.

This patch changes Fixture.new to take the connection object from Fixtures and use it for column quoting. If no connection is provided by the block, the default is AR::Base.connection.

I wasn't sure how to test this particular case. The AR tests are made to be run with different adapters, but I couldn't find examples where a case is using two different ones. Since this change is exercised by existing fixture tests, I left it. Suggestions?

Reported by Jeffrey Hardy · August 26th, 2009 @ 08:11 PM

State: committed
Milestone: 2.3.4
Assigned to: nobody
Importance: none

Activity

  1. Jeremy Kemper
    Jeremy Kemper
    • State changed from new to open
    • Milestone set to 2.3.4

    The existing tests are enough. Putting the connection arg at the end though to avoid breaking folks using this API.

    August 26th, 2009 @ 10:50 PM

  2. Repository
    Repository
    • State changed from open to committed

    (from [8c05ca96f846fd37f99c3986bba5cadb4d7de040]) Don't use AR::Base.connection for fixture column quoting. Use the connection given to Fixtures.new

    [#3104 Fixture columns should be quoted by the appropriate connection state:committed]

    Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
    http://github.com/rails/rails/commit/8c05ca96f846fd37f99c3986bba5ca...

    August 26th, 2009 @ 10:55 PM

  3. Repository
    Repository

    (from [8a49183563d3f80ecd4024977429b62f671f9f7c]) Don't use AR::Base.connection for fixture column quoting. Use the connection given to Fixtures.new

    [#3104 Fixture columns should be quoted by the appropriate connection state:committed]

    Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
    http://github.com/rails/rails/commit/8a49183563d3f80ecd4024977429b6...

    August 26th, 2009 @ 10:55 PM