unique has_many association with pagination breaks

We are facing a problem using the latest version (master) of sqlserver-adapter and will_paginate. Our model has a unique has_many association. Paginating this relation results in invalid sql.

The following example is completely fictional and makes no sense at all but it should illustrate the situation. I can't use the real code and I had to replace the sql-statements so they really don't mean anything.

```ruby
class Article
   has_many(:comment_authors,
           :order => 'created_at')

  has_many(:collaborators,
           :class_name => 'User',
           :through => :comment_authors,
           :uniq => true)
end
```

accessing the relation works as expected:
``` ruby
Article.find(200).collaborators.to_sql 
# => SELECT DISTINCT [collaborators].* FROM [collaborators] INNER JOIN [comment_authors] ON [collaborators].[article_id] = [comment_authors].[article_id] WHERE [comment_authors].[article_id] = 237
```

when I add pagination it breaks:
``` ruby
Article.find(200).collaborators.paginate(:page => 1).to_sql 
# => SELECT TOP (15) [__rnt].* FROM ( SELECT ROW_NUMBER() OVER (ORDER BY [collaborators].[article_id] ASC) AS [__rn], DISTINCT [collaborators].* FROM [collaborators] INNER JOIN [tblTeam] ON [collaborators].[article_id] = [comment_authors].[article_id] WHERE [comment_authors].[article_id] = 237 ) AS [__rnt] WHERE [__rnt].[__rn] > (0) ORDER BY [__rnt].[__rn] ASC
```

The code above results in the following exception:
```
ActiveRecord::StatementInvalid: TinyTds::Error: Incorrect syntax near the keyword 'DISTINCT'.: EXEC sp_executesql N'SELECT TOP (15) [__rnt].* FROM ( SELECT ROW_NUMBER() OVER (ORDER BY [collaborators].[article_id] ASC) AS [__rn], DISTINCT [collaborators].* FROM [collaborators] INNER JOIN [comment_authors] ON [collaborators].[article_id] = [comment_authors].[article_id] WHERE [comment_authors].[article_id] = 237 ) AS [__rnt] WHERE [__rnt].[__rn] > (0) ORDER BY [__rnt].[__rn] ASC'
	from /Users/cr/git_repositories/github/activerecord-sqlserver-adapter/lib/active_record/connection_adapters/sqlserver/database_statements.rb:412:in `each'
	from /Users/cr/git_repositories/github/activerecord-sqlserver-adapter/lib/active_record/connection_adapters/sqlserver/database_statements.rb:412:in `handle_to_names_and_values_dblib'
	from /Users/cr/git_repositories/github/activerecord-sqlserver-adapter/lib/active_record/connection_adapters/sqlserver/database_statements.rb:401:in `handle_to_names_and_values'
	from /Users/cr/git_repositories/github/activerecord-sqlserver-adapter/lib/active_record/connection_adapters/sqlserver/database_statements.rb:373:in `_raw_select'
	from /Users/cr/git_repositories/github/activerecord-sqlserver-adapter/lib/active_record/connection_adapters/sqlserver/database_statements.rb:367:in `block in raw_select'
	from /Users/cr/.rvm/gems/ruby-1.9.3-p194@sfv_webclient/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
	from /Users/cr/.rvm/gems/ruby-1.9.3-p194@sfv_webclient/gems/activesupport-3.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
	from /Users/cr/.rvm/gems/ruby-1.9.3-p194@sfv_webclient/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
	from /Users/cr/git_repositories/github/activerecord-sqlserver-adapter/lib/active_record/connection_adapters/sqlserver/database_statements.rb:367:in `raw_select'
	from /Users/cr/git_repositories/github/activerecord-sqlserver-adapter/lib/active_record/connection_adapters/sqlserver/database_statements.rb:350:in `do_exec_query'
	from /Users/cr/git_repositories/github/activerecord-sqlserver-adapter/lib/active_record/connection_adapters/sqlserver/database_statements.rb:24:in `exec_query'
	from /Users/cr/git_repositories/github/activerecord-sqlserver-adapter/lib/active_record/connection_adapters/sqlserver/database_statements.rb:293:in `select'
	from /Users/cr/.rvm/gems/ruby-1.9.3-p194@sfv_webclient/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:18:in `select_all'
	from /Users/cr/.rvm/gems/ruby-1.9.3-p194@sfv_webclient/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/query_cache.rb:63:in `select_all'
	from /Users/cr/.rvm/gems/ruby-1.9.3-p194@sfv_webclient/gems/activerecord-3.2.6/lib/active_record/querying.rb:38:in `block in find_by_sql'
	from /Users/cr/.rvm/gems/ruby-1.9.3-p194@sfv_webclient/gems/activerecord-3.2.6/lib/active_record/explain.rb:40:in `logging_query_plan'
	from /Users/cr/.rvm/gems/ruby-1.9.3-p194@sfv_webclient/gems/activerecord-3.2.6/lib/active_record/querying.rb:37:in `find_by_sql'
	from /Users/cr/.rvm/gems/ruby-1.9.3-p194@sfv_webclient/gems/activerecord-3.2.6/lib/active_record/relation.rb:171:in `exec_queries'
	from /Users/cr/.rvm/gems/ruby-1.9.3-p194@sfv_webclient/gems/activerecord-3.2.6/lib/active_record/relation.rb:160:in `block in to_a'
	from /Users/cr/.rvm/gems/ruby-1.9.3-p194@sfv_webclient/gems/activerecord-3.2.6/lib/active_record/explain.rb:33:in `logging_query_plan'
	from /Users/cr/.rvm/gems/ruby-1.9.3-p194@sfv_webclient/gems/activerecord-3.2.6/lib/active_record/relation.rb:159:in `to_a'
	from /Users/cr/.rvm/gems/ruby-1.9.3-p194@sfv_webclient/gems/will_paginate-3.0.3/lib/will_paginate/active_record.rb:107:in `block in to_a'
	from /Users/cr/.rvm/gems/ruby-1.9.3-p194@sfv_webclient/gems/will_paginate-3.0.3/lib/will_paginate/collection.rb:96:in `create'
	from /Users/cr/.rvm/gems/ruby-1.9.3-p194@sfv_webclient/gems/will_paginate-3.0.3/lib/will_paginate/active_record.rb:106:in `to_a'
	from /Users/cr/.rvm/gems/ruby-1.9.3-p194@sfv_webclient/gems/activerecord-3.2.6/lib/active_record/relation.rb:498:in `inspect'
	from /Users/cr/.rvm/gems/ruby-1.9.3-p194@sfv_webclient/gems/railties-3.2.6/lib/rails/commands/console.rb:47:in `start'
	from /Users/cr/.rvm/gems/ruby-1.9.3-p194@sfv_webclient/gems/railties-3.2.6/lib/rails/commands/console.rb:8:in `start'
	from /Users/cr/.rvm/gems/ruby-1.9.3-p194@sfv_webclient/gems/railties-3.2.6/lib/rails/commands.rb:41:in `<top (required)>'
	from script/rails:5:in `require'
	from script/rails:5:in `<main>'1.9.3p194 :016 > 
```