Searchlogic gem installed, but I can't access methods
I've just installed the searchlogic gem, but when I try to access basic methods via the console, I'm getting the following error:
>> User.username_not_null
NoMethodError: undefined method `username_not_null' for #<Class:0x1033a1d90>
from /Library/Ruby/Gems/1.8/gems/searchlogic-2.4.27/lib/searchlogic/named_scopes/conditions.rb:81:in `method_missing'
from /Library/Ruby/Gems/1.8/gems/searchlogic-2.4.27/lib/searchlogic/named_scopes/association_conditions.rb:19:in `method_missing'
from /Library/Ruby/Gems/1.8/gems/searchlogic-2.4.27/lib/searchlogic/named_scopes/association_ordering.rb:27:in `method_missing'
from /Library/Ruby/Gems/1.8/gems/searchlogic-2.4.27/lib/searchlogic/named_scopes/ordering.rb:30:in `method_missing'
from /Library/Ruby/Gems/1.8/gems/searchlogic-2.4.27/lib/searchlogic/named_scopes/or_conditions.rb:28:in `method_missing'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1959:in `method_missing'
from (irb):1
I'm still getting the hang of Gems开发者_Go百科, which often throw me for a loop -- can anyone point me in the right direction to fix this?
Don't use Searchlogic for what you can use Rails for:
User.all(:conditions => ["username IS NOT NULL"])
精彩评论