Comments (6)
Sorry about not being very clear in the readme, I'm not sure how to improve it. Nothing is underway currently. Please go ahead and send a PR.
from order_query.
Not documentation but I went looking for examples where others are using it.
This project uses order_query.
https://github.com/MidnightRiders/MemberPortal/blob/03f72f47a650eb609d9b1c8e595ae3ad546ab581/app/views/matches/show.html.haml
In case that project disappears, this is the view that renders the next/previous links:
.row
.small-4.medium-3.large-2.columns
- if @order_point.previous(false)
= link_to @order_point.previous(false), class: "button small expand primary-bg #{@order_point.previous(false).home_team.abbrv.downcase}" do
= icon 'arrow-left'
= @order_point.previous(false).home_team.abbrv
v
= @order_point.previous(false).away_team.abbrv
= @order_point.previous(false).kickoff.strftime('%_m.%-d')
.small-4.medium-6.large-8.columns.text-center
= link_to matches_path(date: @match.kickoff.to_date), class: 'button small' do
= icon 'calendar fa-fw'
Back
.small-4.medium-3.large-2.columns.right
- if @order_point.next(false)
= link_to @order_point.next(false), class: "button small expand primary-bg #{@order_point.next(false).home_team.abbrv.downcase}" do
= @order_point.next(false).home_team.abbrv
v
= @order_point.next(false).away_team.abbrv
= @order_point.next(false).kickoff.strftime('%_m.%-d')
= icon 'arrow-right'
The controller sets up the @order_point
object by doing @order_point = @match.order_selected(Match.all_seasons)
And the Match model has this code:
order_query :order_selected,
%i(kickoff asc),
%i(location asc)
I have not pulled that project and attempted to run it. I've only sorted through to see how order_query was being used.
from order_query.
Hi, if it can help you, you can take a look on how it's implemented here: https://github.com/rogercampos/toqua/blob/master/lib/toqua/keyset_pagination.rb
from order_query.
Hi, any additional documentation underway? If not, I'd be willing to contribute. My sense is that the usage explanation for the 'order_query' method could be a little clearer, and the examples might to well to use the limit method to make clear how the gem expects you to us AR to receive chunks.
from order_query.
@glebm Took a shot at clarifying the documentation on points where I got a little confused. And added a point about using limit. Let me know what you think!
from order_query.
Hi everyone, thanks for the various explanations, and thanks @niborg for the PR to expand the documentation. I'm getting a clearer idea of how this library can be used.
from order_query.
Related Issues (20)
- Ordering by NULLS FIRST / LAST HOT 10
- new version release HOT 1
- Test on multiple databases
- is sorting by an associated column supported? HOT 10
- pass table and column to custom sql function HOT 11
- Nulls ordering skips records if there is more than one NULL HOT 6
- TODO: Better tests for nils in enums
- Change base scope? HOT 2
- Get point for reverse scope HOT 2
- Rails 6 support HOT 2
- Wrong order? HOT 1
- Top-level disjunctive causes sub-optimal query plan HOT 6
- Calling prev and next when the ordering model attribute is enumerable creates an invalid SQL where clause HOT 2
- Redundant condition elimination
- #seek or #at with previously specified order HOT 5
- Can this sort on nested attributes? HOT 3
- Feature Request: HOT 1
- .previous always showing first record when limiting scope HOT 2
- Not compatible with rails 5 HOT 1
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 order_query.