2012-02-02 3 views
0

J'utilise un petit bijou de datatables (https://github.com/potatosalad/mongoid-data_table) qui soutient MongoId, Mais exception ressuscitant code suivantquestion datatables avec 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' 

Ce sont mes joyaux mongo

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

Répondre

0

Je sais qu'à un moment donné, il y avait un problème avec la gemme bson 1.4.0 et ils l'ont effectivement révoquée, puis en ont retiré une nouvelle. Peut-être essayer de mettre à jour bson et bson_ext gemmes. Vous pouvez supprimer la gemme mongo du Gemfile, car il s'agit d'une dépendance pour mongoid. De même, vous pouvez supprimer la gemme bson de votre Gemfile car c'est une dépendance pour mongo (qui est une dépendance pour mongoid). Supprimez également la spécification de version de la gemme bson_ext. Puis faites bundle update bson et bundle update bson_ext. Voyez si cela le corrige.