Code Monkey home page Code Monkey logo

Comments (6)

glebm avatar glebm commented on May 24, 2024 1

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.

saturnflyer avatar saturnflyer commented on May 24, 2024

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.

rogercampos avatar rogercampos commented on May 24, 2024

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.

niborg avatar niborg commented on May 24, 2024

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.

niborg avatar niborg commented on May 24, 2024

@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.

twelve17 avatar twelve17 commented on May 24, 2024

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)

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.