Giter Club home page Giter Club logo

will_paginate_mongoid's Introduction

Will Paginate Mongoid

A simple gem that allows you to use pagination with Mongoid

Why use this gem?

Because will_paginate does not support the mongoid skip and limit methods. They just support the paginate method in the Array class. What does this mean? Will_Paginate will find all the objects and then cut out the unneeded ones. This can cause performance problems when you have a lot of objects.

How I install it?

Add gem "will_paginate_mongoid" to your Gemfile and run bundle install

or

Just run gem install will_paginate_mongoid

How it works?

It just creates a paginate method compatible with will_paginate interface and adds two additional criteria: skip and limit

That's it?

Yes. Now you can use the paginate method just like in the will_paginate documentation

will_paginate_mongoid's People

Contributors

bogwro avatar campeterson avatar glongman avatar jmif avatar junwchina avatar lucasas avatar pmq20 avatar tomk32 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

will_paginate_mongoid's Issues

Rails 4 compatibility

When I install rails 4 I am getting the error:

Bundler could not find compatible versions for gem "activemodel":
  In Gemfile:
    will_paginate_mongoid (>= 0) ruby depends on
      activemodel (~> 3.2) ruby

    simple_form (= 3.0.1) ruby depends on
      activemodel (4.0.2)

Gemfile

gem "rails", '~>4.0.0'
gem 'will_paginate_mongoid', :git => "https://github.com/lucasas/will_paginate_mongoid.git"

Error on heroku

Heroku raises
NoMethodError (undefined method `paginate' for []:Array)

gem depends mongoid version only 2.2.2 ?

Hello,

Thanks for u gem, It 's very cool,

but I have a problem , I use mongoid (version is 2.3.4) ,but will_paginate_mongo use mongid 2.2.2

Bundler could not find compatible versions for gem "mongoid":
In Gemfile:
will_paginate_mongoid (>= 0) ruby depends on
mongoid (~> 2.2.2) ruby

mongoid (2.3.4)

Always uses count?

Hello, I am really a newbie so maybe I am about to say something foolish but as far as I understand this gem always uses 'self.count' for calculating the total amount of entries and therefore there is no 'total_entries' method for pagination which is not convinient in many ways for perfomance. So, if what i've said correct, are you going to fix it somehow?

Mongoid 3.x support

Any change of supporting the newest release of Mongoid 3.x? The new release isn't backwards compatible so it might involve a bit more work to update the gem.

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

Does not work with full text search

Hi,

I get _undefined method `paginate' for #<Mongoid::Contextual::TextSearch_ if I try to paginate a full text search.

@ads = Ad.text_search( params[:q] )
  .paginate(:page => params[:page], :per_page => 10 )

It does however work nice if I don't do a search. E.g.:

Ad.paginate(:page => params[:page])

Any suggestions to how full text search and will paginate can play together?

Cheers,
Martin

Maybe can work in mongoid (3.0.3)

Hello,

I found in will_paginate_mongoid.gemspec set s.add_runtime_dependency "mongoid", "~> 2.4" ,

Now mongoid version is aleady 3.0.x ,

I update my mongoid version to 3.0.3 and fork your will_paginate_mongoid. update the will_paginate_mongoid.gemspec file,

remove the version code, Use will_paginate_mongoid in mongoid(3.0.3) , It 's seem all ok . :P........

Licensing

The project doesn't include a license file, rendering legally unusable, please choose a license.

Inject other methods

Hi,
I have this model class in Rails that features a to_xlsx class method. I expected it to work as follows:

Book.paginate(page: 1, per_page: 10).to_xlsx

Unfortunately this does not work:

undefined method `to_xlsx' for #<WillPaginate::Collection:0x0000562a2aded870>

What is the recommended way to inject these routines?

Cheers!

will_paginate view helper not loading

When I use "will_paginate @pages" in my Rails 3.0.7 app with Mongoid 2.2.2, I get:

undefined method `will_paginate' for #<#Class:0x007fdc21a08980:0x007fdc21a03fc0>

if I include this at the top of my view:

require 'will_paginate/view_helpers/action_view'

Then everything works. Clearly, something is clobbering the Railtie file to prevent it from loading the view helper at load. Can't really figure out why it's failing, though. If you can provide insight into why this might be occurring, I'd appreciate it!

Example

i'd really like an example of how it works and how its implemented, because i cant seem to get it to work, always ending up in a
undefined method `total_pages' for #Array:0x2ab57f6ca3b8
in my sinatra app.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.