I have the following named scope:
named_scope :report_search, lambda { |search|
{
:conditions => ["rep_name like ? or rep_id like ? or rep_symbol like ? or rep_issue like ?", search]
}
}
When i run it, I get the error message:
wrong number of bind variables
I would appreciate it if somebody could help me figure out wht's wrong with the code.
Many thanks
You can use named bind variables if you don't want to repeat the input.
named_scope :report_search, lambda { |search|
{
:conditions => [" rep_name LIKE :search OR
rep_id LIKE :search OR
rep_symbol LIKE :search OR
rep_issue LIKE :search", :search => search]
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With