rails-sqlserver/activerecord-sqlserver-adapter — pull request #217 by christophritler (2012-08-03 11:05:41+00:00)
Title: bug fix: multiline queries do not raise error when explained

Statement:
==

```
"SELECT [cars].* FROM [cars] WHERE (\n id = 1 \n)"
```

Exception:
==

```
test: Unprepare previously prepared SQL should from multiline statement. (ShowplanTestSqlserver):
NoMethodError: undefined method `[]' for nil:NilClass
/Users/cr/git_repositories/github/activerecord-sqlserver-adapter/lib/active_record/connection_adapters/sqlserver/core_ext/explain.rb:26:in `unprepare_sqlserver_statement'
/Users/cr/git_repositories/github/activerecord-sqlserver-adapter/lib/active_record/connection_adapters/sqlserver/core_ext/explain.rb:11:in `block in exec_explain'
/Users/cr/git_repositories/github/activerecord-sqlserver-adapter/lib/active_record/connection_adapters/sqlserver/core_ext/explain.rb:11:in `map'
/Users/cr/git_repositories/github/activerecord-sqlserver-adapter/lib/active_record/connection_adapters/sqlserver/core_ext/explain.rb:11:in `exec_explain'
/Users/cr/.rvm/gems/ruby-1.9.3-p194@sqlserver-adapter/bundler/gems/rails-0ff738a6f491/activerecord/lib/active_record/relation.rb:147:in `explain'
test/cases/showplan_test_sqlserver.rb:17:in `block (2 levels) in '
/Users/cr/.rvm/gems/ruby-1.9.3-p194@sqlserver-adapter/gems/shoulda-2.10.3/lib/shoulda/context.rb:362:in `call'
/Users/cr/.rvm/gems/ruby-1.9.3-p194@sqlserver-adapter/gems/shoulda-2.10.3/lib/shoulda/context.rb:362:in `block in create_test_from_should_hash'
/Users/cr/.rvm/gems/ruby-1.9.3-p194@sqlserver-adapter/gems/mocha-0.9.8/lib/mocha/integration/mini_test/version_131_and_above.rb:26:in `run'
```