2010-11-19 53 views
0

我剛剛安裝searchlogic寶石,但是當我試圖通過控制檯訪問基本方法,我發現了以下錯誤:Searchlogic寶石安裝,但我不能訪問方法

>> 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 

我仍然得到寶石的縈繞,這經常讓我陷入循環 - 任何人都可以指出我正確的方向來解決這個問題嗎?

+1

您使用的軌道3?我不認爲searchlogic在rails 3中工作。http://www.railsplugins.org/plugins/452-searchlogic?version_id=890 – re5et 2010-11-19 07:16:05

+0

沒有。 Rails 2.3.5 – iamlemur 2010-11-19 07:30:43

回答

1

不要使用Searchlogic什麼,你可以使用Rails的爲:

User.all(:conditions => ["username IS NOT NULL"]) 
+0

謝謝,但我安裝它的更強大的選項 - 只是使用「username_not_null」作爲一個簡單的例子,而我試圖讓它建立。 – iamlemur 2010-11-19 07:30:17