recourse 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd168efcdd88afa58c1b4bc5a5c7c4fc71bc91caec7b7a8ad344f41d7f2b3eb0
4
- data.tar.gz: 4c6858fa894182eda4378571397b962fff778d172f7e749cc31e976776c71f50
3
+ metadata.gz: c973577fe92594d79876e10d764d86fc531b245e7ba88aaf9280ac8e78ef2810
4
+ data.tar.gz: 3cf1342f0c00d967da21613c7002b614bf29556450e323c6989f049c3e1770c9
5
5
  SHA512:
6
- metadata.gz: 065fcb2ed2b597570045209d931b5dc74f6e12b30f39e3456dbbb7a635038a62d8b4e542764297df205b51c1163fe86937613ac5c6d69cd1def9f2dfeb40262d
7
- data.tar.gz: ca93b998e63631993f14b55dc1ed8f2dcd3d9380eb57198f11e235cbaa366520a2f1247a4745e0c5c7b1cdcd9f1daf298b448ef975e29ac255d02ccca6e0340c
6
+ metadata.gz: 15e312b8b2c61a9aac746fa8ab5ec7efa0497a754867044a36d571ad69957f15174cc43aedfde0e78cc3f38154d8612ca89c88e447fdd4866f2525a3c8325d82
7
+ data.tar.gz: 8160ec16b83366673eb2120f9b42b17bfe88879914c0962947239a897cb1f2fa6396337860831f0fed73cd1dd4d74388d8006cf35717f1be02d5deab3fbfbf80
data/README.md CHANGED
@@ -27,7 +27,6 @@ In a resourceful Active Record model:
27
27
  - `recourse_includes`: the associations to include when fetching the resources
28
28
  - `recourse_order`: the SQL to sort the resources by
29
29
  - `recourse_positionable?`: whether the model has a position field to drag'n'drop sort
30
- - `recourse_searchable?`: whether the model has Ransack enabled for searches
31
30
 
32
31
  Anywhere:
33
32
 
@@ -12,7 +12,7 @@ class RecourseController < ApplicationController
12
12
  private
13
13
 
14
14
  def paginate(model, includes: [], order: nil)
15
- if model.recourse_searchable?
15
+ if model.recourse_searchable? || model.recourse_sortable?
16
16
  @q = model.ransack params[:q]
17
17
  @q.sorts = (order || 'created_at desc') if @q.sorts.empty?
18
18
  pagy includes.present? ? @q.result.includes(includes) : @q.result.distinct(true)
@@ -28,9 +28,14 @@ module Recourse
28
28
  false
29
29
  end
30
30
 
31
- # @return [Boolean] whether Ransack attributes are defined on the resource.
31
+ # @return [Boolean] whether Ransack search attributes are defined on the resource.
32
32
  def recourse_searchable?
33
- ransackable_attributes.any? || ransortable_attributes.any?
33
+ ransackable_attributes.any?
34
+ end
35
+
36
+ # @return [Boolean] whether Ransack sort attributes are defined on the resource.
37
+ def recourse_sortable?
38
+ ransortable_attributes.any?
34
39
  end
35
40
  end
36
41
  end
@@ -1,3 +1,3 @@
1
1
  module Recourse
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recourse
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo