Skip to content

Conversation

@themilkman
Copy link
Contributor

[Sorry for creating a second pullrequest for the same issue, the original branch was messed up..]

Hi,

I got this error:

lib/active_record/connection_adapters/sqlserver/database_statements.rb:6:in `select_rows': wrong number of arguments (3 for 2) (ArgumentError) 

with Rails 4.0.4 and the master branch of the activerecord-sqlserver-adapter.

Hope you will merge this pull request which should solve the issue. Thanks!

Cheers
Erik

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to change the args to select_rows(sql, opts={}) or something like that? Doing the way you have, there's no way to differentiate between passing in only name or only binds.

@themilkman
Copy link
Contributor Author

Hi @cbankester,
this might be useful in some cases, yes. But I oriented my implementation on the original abstract class of rails:
https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb#L49
Anyway, I do not think that adding the opts-parameter would solve the 3 for 2 ArgumentError without further work, would it?
So I think it's better this way and to pass a nil-param in case that you wish to pass only binds select_rows(sql, nil, [:mystuff])

Cheers!

annaswims added a commit that referenced this pull request Mar 26, 2014
Fixed Argutement Error in statements.rb
@annaswims annaswims merged commit 5a32bdc into rails-sqlserver:master Mar 26, 2014
@annaswims
Copy link
Contributor

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants