Comments (8)
I fixed it by adding a line ( query.delete :order ) in the page method, agree with that?:
def page page = nil, options = {}
options, page = page, nil if page.is_a? Hash
page ||= pager_option :page, options
options.delete :page
page = 1 unless (page = page.to_i) && page > 1
per_page = pager_option(:per_page, options).to_i
query = options.dup
collection = new_collection scoped_query(options = {
:limit => per_page,
:offset => (page - 1) * per_page,
:order => [:id.desc]
}.merge(query))
query.delete :order <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
options.merge! :total => count(query), :page => page
collection.pager = DataMapper::Pager.new options
collection
end
from dm-pagination.
That is something to take up with DM core, I would not go explicitly deleting :order, because it works fine with other RDMS
from dm-pagination.
Ok, anyway removing the option :order will not affect the collection itself, I'm removing the :order only for the aggregate function "count", because the order hasn't any sense for an aggregate function.
thanks for your quickly answer!
from dm-pagination.
ah, right sorry didnt look closely enough lol its probably fine then
from dm-pagination.
Cool cool I committed the change :D thanks. Your totally right though I just had read it wrong originally when I scanned over the issue
from dm-pagination.
good man! now I'm going to remove the monkey patch :)
from dm-pagination.
hi visionmedia, it's been a long time since my last message and untill now I didn't deployed the app to heroku and now I'm realizing that the gem still throwing the same exception, this is because you removed the :order option to the 'options' instead of to the 'query' as I wrote in my second message.
hope you can modify it for the next version.
from dm-pagination.
My bad! typo, 1.0.1 fixes this
from dm-pagination.
Related Issues (20)
- Remove #first and #last
- Configurable "..." text HOT 1
- Specs for options at the #to_html level
- Sinatra helper
- Display first / last in the <ul> HOT 3
- rename / publish gem
- Provide a class to all "jump" links (first, last, next, previous)
- Example css styles HOT 1
- ORM agnostic
- Allow Page 1 of n style
- Add 'outer window' support
- Fix issue when other keys are similar to "page" they may be replaced
- Centering with css
- Append QUERY_STRING for the .to_html method HOT 1
- :total records count broken for queries with limits HOT 5
- Order HOT 1
- to_json support HOT 1
- For pager, if :last_page or :first_page text is empty, don't show those links HOT 2
- dm-pager doesn't works with DataMapper 1.2.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dm-pagination.