Skip to content

Instantly share code, notes, and snippets.

@jpzwarte
Created November 14, 2011 08:23
Show Gist options
  • Save jpzwarte/1363520 to your computer and use it in GitHub Desktop.
Save jpzwarte/1363520 to your computer and use it in GitHub Desktop.
Failing test
1) Error:
test_coerced_test_delete_all_with_join(DeleteAllWithJoinTest):
ActiveRecord::StatementInvalid: TinyTds::Error: The multi-part identifier "posts.author_id" could not be bound.: EXEC sp_executesql N'DELETE FROM [people] WHERE [posts].[author_id] IS NULL; SELECT @@ROWCOUNT AS AffectedRows'
require 'cases/sqlserver_helper'
require 'models/person'
require 'models/post'
require 'models/reader'
class DeleteAllWithJoinTestSqlServer < ActiveRecord::TestCase
end
class DeleteAllWithJoinTest < ActiveRecord::TestCase
COERCED_TESTS = [:test_delete_all_with_join]
include SqlserverCoercedTest
fixtures :people, :readers, :posts
def test_coerced_test_delete_all_with_join
queries = assert_sql { Person.joins(:posts).where(:posts => { :author_id => nil }).delete_all }
puts queries.inspect
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment