binarylogic / searchlogic

Searchlogic provides object based searching, common named scopes, and other useful tools.
http://rdoc.info/projects/binarylogic/searchlogic
MIT License
1.39k stars 133 forks source link

You have a nil object when you didn't expect it! #98

Open jmaniv opened 14 years ago

jmaniv commented 14 years ago

I have install searchlogic then tried in ruby script/console

search=BankingDetail.search(:name_like_all=>"man") search.all

i got error when i call 'all' method

NoMethodError: You have a nil object when you didn't expect it! You might have expected an instance of ActiveRecord::Base. The error occurred while evaluating nil.[]

kotsaris commented 14 years ago

i have the exact same issue. ie i write..

Product.search(:descr_equals => "test").all and it returns nil

while Product.descr_equals("test").all returns the collection as normal

Rails 2.3.8, Ruby 1.8.7

update: my bad, i had a named_scope in my model called :all which was empty ... :P