2012-02-02 70 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。看看是否修复它。