I am trying to execute following line in rails console (bundle exec rails c):
query = select("product.id").where("admin_id = ? and account_id = ?", 3, 4)
But I get following error:
TypeError: wrong argument type String (expected Array)
from (irb):83:in `select'
This code seems to be working fine in the application as such. Any clue on why it is failing in irb?
ruby version -> 1.9.3p545
Rails version -> 3.2.8
This code is originally defined in a ActiveRecord class (Product) in a scope. How to execute it through rails console ?
irborrails console. Also what context are you executing it in. It seems you want to call it in a context of some ActiveRecord class, you are missing a receiver here.