kaminari / kaminari-mongoid Goto Github PK
View Code? Open in Web Editor NEWKaminari Mongoid adapter
License: MIT License
Kaminari Mongoid adapter
License: MIT License
Hello,
our app has a class which includes Mongoid::Document and many subclasses.
the following exception is thrown Mongoid::Errors::ScopeOverwrite when kaminari-mongoid attempts to add page scope to each of the subclasses (file mongoid_extensions:12)
mongoid 4.0.2
kaminari master
kaminari-mongoid master
I just moved from 0.16.x to the last github version in order to have the new params_on_first_page
config.
I use the last versions from https://github.com/amatsuda/kaminari and https://github.com/kaminari/kaminari-mongoid and got this error on server start:
....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/kaminari-mongoid-0.1.1/lib/kaminari/mongoid/mongoid_extension.rb:24:in `<module:Document>': uninitialized constant Kaminari::Mongoid::VERSION (NameError)
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/kaminari-mongoid-0.1.1/lib/kaminari/mongoid/mongoid_extension.rb:6:in `<module:MongoidExtension>'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/kaminari-mongoid-0.1.1/lib/kaminari/mongoid/mongoid_extension.rb:5:in `<module:Mongoid>'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/kaminari-mongoid-0.1.1/lib/kaminari/mongoid/mongoid_extension.rb:4:in `<module:Kaminari>'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/kaminari-mongoid-0.1.1/lib/kaminari/mongoid/mongoid_extension.rb:3:in `<top (required)>'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/kaminari-mongoid-0.1.1/lib/kaminari/mongoid.rb:3:in `require'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/kaminari-mongoid-0.1.1/lib/kaminari/mongoid.rb:3:in `<top (required)>'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:100:in `require'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:100:in `rescue in block in require'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:77:in `block in require'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `each'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `require'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:102:in `require'
from ......config/application.rb:17:in `<top (required)>'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:78:in `require'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `tap'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `server'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
from .../...bin/rails:8:in `require'
from ......bin/rails:8:in `<top (required)>'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/spring-1.6.4/lib/spring/client/rails.rb:28:in `load'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/spring-1.6.4/lib/spring/client/rails.rb:28:in `call'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/spring-1.6.4/lib/spring/client/command.rb:7:in `call'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/spring-1.6.4/lib/spring/client.rb:28:in `run'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/spring-1.6.4/bin/spring:49:in `<top (required)>'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/spring-1.6.4/lib/spring/binstub.rb:11:in `load'
from ....rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/spring-1.6.4/lib/spring/binstub.rb:11:in `<top (required)>'
from ....rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from ....rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from .../...bin/spring:13:in `<top (required)>'
from .../...bin/rails:3:in `load'
from .../...bin/rails:3:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
Thanks
Any plans to implement this?
The Kaminari readme provides this example:
User.page(3).without_count
However I'm getting the exception:
undefined method `without_count' for #<Mongoid::Criteria:0x00000000065afa90>
Any ideas?
See below example:
#controller
@templates = Template.where(read_conditions).order_by(updated: :desc).page(params[:page]).per(params[:per_page]) # does not matter if per_page is supplied or nil
(byebug) @templates[5]
nil
(byebug) @templates.count
8
(byebug) @templates.entries.count
5
(byebug) @templates.entries.size
5
(byebug) @templates.class
Mongoid::Criteria
for @templates[0]
.. @templates[4]
there are values.
Just updated to new kaminari and got this error.
I have replaced 'kaminari' with 'kaminari-mongoid' in gemfile und updated bundle.
Back to 0.17.0 for now.
by
TheR
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.