Sha256: 754471c329fd998e1516aee93e218d8e8f4beb2b8c78aaaa87e67f6584e66b21

Contents?: true

Size: 448 Bytes

Versions: 10

Compression:

Stored size: 448 Bytes

Contents

module Helpers::Base
  include Pagy::Frontend
  include Pagy::Backend

  def has_order?(scope)
    # This scope has an order if the SQL changes when we remove any order clause.
    scope.to_sql != scope.reorder("").to_sql
  end

  # TODO This should really be in the API package and included from there.
  if defined?(BulletTrain::Api)
    def render_pagination(json)
      if @pagy
        json.has_more @pagy.has_more
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
bullet_train-1.1.10 app/helpers/concerns/helpers/base.rb
bullet_train-1.1.9 app/helpers/concerns/helpers/base.rb
bullet_train-1.1.7 app/helpers/concerns/helpers/base.rb
bullet_train-1.1.6 app/helpers/concerns/helpers/base.rb
bullet_train-1.1.5 app/helpers/concerns/helpers/base.rb
bullet_train-1.1.4 app/helpers/concerns/helpers/base.rb
bullet_train-1.1.3 app/helpers/concerns/helpers/base.rb
bullet_train-1.1.2 app/helpers/concerns/helpers/base.rb
bullet_train-1.1.1 app/helpers/concerns/helpers/base.rb
bullet_train-1.1.0 app/helpers/concerns/helpers/base.rb