table_sortable 1.0.0.pre.alpha.13 → 1.0.0.pre.alpha.14

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
  SHA1:
3
- metadata.gz: b9759388df136fc01767628b691d9c6b03b375d0
4
- data.tar.gz: 33ab2ec5d49f15591566fc6b649efd3df5d5f852
3
+ metadata.gz: e7a82828045598ce128b6a87cf868658298439bb
4
+ data.tar.gz: c0259c3b6d5656afcd0ee912c632e3e0a03e3f9e
5
5
  SHA512:
6
- metadata.gz: e6f90cd6380bbea36f0db6e8e4c9d4fcf921e85f12aff688fda8deccf031c7e22824ccab768b46eb988b6e5df1a30597b5945b55a4720188349e870fbba4d2cc
7
- data.tar.gz: 01e168d4a139ae89106d1b984026e300f1d477c9b68da574a10956e26d4f983a4b1245e97e537de4aa2694074872ca32bcbaa92bda03136837c0f695003f8577
6
+ metadata.gz: a8cc0ea7a17b998735c303b081e43f47393c20ba7014d3912c570a7f6811a5d2a0e231fff76631c2a891c2b9769813bc3a3ec0e16fd1ab0dae6433a98c50282f
7
+ data.tar.gz: 0c748c81881144e60ce79385a992c6b339671124f48123b98ccfba14a7d3b7bd2ad6e0646cc4579b942c4a0480738f3d33b0c7f93dd0b1f0deddb76d696eb5a3
@@ -16,7 +16,7 @@ module TableSortable
16
16
  template = options[:template] || col_name
17
17
  column_options = options[:options] || {}
18
18
  includes = options[:includes] || []
19
- scope = options[:scope]
19
+ scope = options[:scope].is_a?(Symbol) ? (-> { send(options[:scope]) }) : options[:scope]
20
20
  visible = options[:visible].nil? ? true : options[:visible]
21
21
 
22
22
  @name = col_name.to_sym
@@ -68,6 +68,15 @@ module TableSortable
68
68
  scope
69
69
  end
70
70
 
71
+ def include_and_scope(scope)
72
+ includes = columns.map{|rc| rc.includes}.flatten.compact.uniq
73
+ the_scope = scope.includes(includes)
74
+ columns.map{|rc| rc.scope}.flatten.compact.uniq.each do |scope_proc|
75
+ the_scope = the_scope.instance_exec(&scope_proc)
76
+ end
77
+ the_scope
78
+ end
79
+
71
80
  def initialize_table_sortable
72
81
  @columns = TableSortable::Columns.new
73
82
  define_column_offset 0
@@ -1,3 +1,3 @@
1
1
  module TableSortable
2
- VERSION = "1.0.0.pre.alpha.13"
2
+ VERSION = "1.0.0.pre.alpha.14"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_sortable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.alpha.13
4
+ version: 1.0.0.pre.alpha.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oded Davidov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-05 00:00:00.000000000 Z
11
+ date: 2017-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler