2012-02-02 67 views
0

我使用一個數據表寶石(https://github.com/potatosalad/mongoid-data_table)支持MongoID, 但異常是從下面的代碼提高數據表與MongoID問題,Rails的3.1

format.json do 
    render :json => Game.to_data_table(self) 
end 

Game.to_data_table(self) 


INTERNAL ERROR!!! undefined method `page' for #<Array:0xb38d7bc> 
    /home/naveed/.rvm/gems/[email protected]/gems/mongoid-2.2.5/lib/mongoid/criteria.rb:369:in `method_missing' 
    /home/naveed/.rvm/gems/[email protected]/bundler/gems/mongoid-data_table-23283e37979c/lib/mongoid/data_table/proxy.rb:47:in `collection' 
    /home/naveed/.rvm/gems/[email protected]/bundler/gems/mongoid-data_table-23283e37979c/lib/mongoid/data_table/proxy.rb:263:in `method_missing' 
    /home/naveed/.rvm/gems/[email protected]/gems/ruby-debug19-0.11.6/cli/ruby-debug/commands/eval.rb:47:in `block in execute' 
    /home/naveed/.rvm/gems/[email protected]/gems/ruby-debug19-0.11.6/cli/ruby-debug/commands/eval.rb:19:in `run_with_binding' 
    /home/naveed/.rvm/gems/[email protected]/gems/ruby-debug19-0.11.6/cli/ruby-debug/commands/eval.rb:46:in `execute' 
    /home/naveed/.rvm/gems/[email protected]/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:280:in `one_cmd' 
    /home/naveed/.rvm/gems/[email protected]/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:261:in `block (2 levels) in process_commands' 
    /home/naveed/.rvm/gems/[email protected]/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:260:in `each' 
    /home/naveed/.rvm/gems/[email protected]/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:260:in `block in process_commands' 
    /home/naveed/.rvm/gems/[email protected]/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:253:in `catch' 
    /home/naveed/.rvm/gems/[email protected]/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:253:in `process_commands' 
    /home/naveed/.rvm/gems/[email protected]/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:173:in `at_line' 
    (eval):5:in `block in at_line' 
    <internal:prelude>:10:in `synchronize' 
    (eval):3:in `at_line' 

這些都是我蒙戈寶石

gem 'mongo' 
gem "mongoid", "~> 2.1" 
gem 'bson', '= 1.4.0' 
gem 'bson_ext', '= 1.4.0' 

回答

0

我知道在某一時刻,寶石出現了問題,他們實際上已經撤消了寶石,然後又放回了一塊新寶石。也許嘗試升級bsonbson_ext寶石。您可以從Gemfile中刪除mongo gem,因爲它是mongoid的依賴項。同樣,您可以從Gemfile中刪除bson gem,因爲它是mongo(它是mongoid的依賴項)的依賴項。同時刪除bson_ext寶石的版本規格。然後做bundle update bsonbundle update bson_ext。看看是否修復它。