[英]Datatables issue with MongoID , Rails 3.1
I am using a datatables gem ( https://github.com/potatosalad/mongoid-data_table ) which supports MongoID, But exception is raising from following code 我正在使用一个支持MongoID的datatables gem( https://github.com/potatosalad/mongoid-data_table ),但是以下代码引发了异常
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/ruby-1.9.2-p290@rails3/gems/mongoid-2.2.5/lib/mongoid/criteria.rb:369:in `method_missing'
/home/naveed/.rvm/gems/ruby-1.9.2-p290@rails3/bundler/gems/mongoid-data_table-23283e37979c/lib/mongoid/data_table/proxy.rb:47:in `collection'
/home/naveed/.rvm/gems/ruby-1.9.2-p290@rails3/bundler/gems/mongoid-data_table-23283e37979c/lib/mongoid/data_table/proxy.rb:263:in `method_missing'
/home/naveed/.rvm/gems/ruby-1.9.2-p290@rails3/gems/ruby-debug19-0.11.6/cli/ruby-debug/commands/eval.rb:47:in `block in execute'
/home/naveed/.rvm/gems/ruby-1.9.2-p290@rails3/gems/ruby-debug19-0.11.6/cli/ruby-debug/commands/eval.rb:19:in `run_with_binding'
/home/naveed/.rvm/gems/ruby-1.9.2-p290@rails3/gems/ruby-debug19-0.11.6/cli/ruby-debug/commands/eval.rb:46:in `execute'
/home/naveed/.rvm/gems/ruby-1.9.2-p290@rails3/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:280:in `one_cmd'
/home/naveed/.rvm/gems/ruby-1.9.2-p290@rails3/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:261:in `block (2 levels) in process_commands'
/home/naveed/.rvm/gems/ruby-1.9.2-p290@rails3/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:260:in `each'
/home/naveed/.rvm/gems/ruby-1.9.2-p290@rails3/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:260:in `block in process_commands'
/home/naveed/.rvm/gems/ruby-1.9.2-p290@rails3/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:253:in `catch'
/home/naveed/.rvm/gems/ruby-1.9.2-p290@rails3/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:253:in `process_commands'
/home/naveed/.rvm/gems/ruby-1.9.2-p290@rails3/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'
These are my mongo gems 这些是我的蒙哥宝石
gem 'mongo'
gem "mongoid", "~> 2.1"
gem 'bson', '= 1.4.0'
gem 'bson_ext', '= 1.4.0'
I know that at one point there was a problem with the bson 1.4.0
gem and they actually revoked it and then put a new one back out. 我知道有一次bson 1.4.0
gem出现了问题,他们实际上撤消了它,然后又重新推出了一个。 Perhaps try upgrading bson
and bson_ext
gems. 也许尝试升级bson
和bson_ext
gem。 You can remove the mongo
gem from the Gemfile, as it is a dependency for mongoid
. 您可以从Gemfile中删除mongo
gem,因为它是mongoid
的依赖mongoid
。 Likewise, you can remove the bson
gem from your Gemfile since it is a dependency for mongo
(which is a dependency for mongoid
). 同样,您可以从Gemfile中删除bson
gem,因为它是mongo
的依赖项(这是mongoid
的依赖mongoid
)。 Also remove the version specification for the bson_ext
gem. 还要删除bson_ext
gem的版本规范。 Then do bundle update bson
and bundle update bson_ext
. 然后执行bundle update bson
和bundle update bson_ext
。 See if that fixes it. 看看是否能解决问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.