effective_datatables 3.6.1 → 3.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98c62cd44b70abef44f1a3c287cb4bfac24ea5f9694b99186a1e29522b64d027
4
- data.tar.gz: 523ab0b6f3f277e3dd4fc9043d7101620b180bd975ce31f249eb0f7f13f24f41
3
+ metadata.gz: 509cfa19dfd481e41030c2ba527e34b23b41fdd66485d53923317b43938e0f56
4
+ data.tar.gz: bfb1dcae3e580fcf1795290cbb543a68f741b2442484289b23f50c421ae98153
5
5
  SHA512:
6
- metadata.gz: 0c83ba0be0f20ca89f85cbeddd7b8b4a868cdd9ce10f1ac714b07581db902432a06cb7394c43afa9c00700df0aed1dd7209ac6b2a1bafa314f1ce17d8bea56e9
7
- data.tar.gz: e6cdd6944a465b63f059ee64e34c56a39a65bc4fa7a03e2f69bf4c55a4205d78d747a0bbc450e626d4c41a03629a774b2da91d601c110d2b0b26c497a40b73ee
6
+ metadata.gz: ea2b82022025d623e56b0b2b5425b2161dcc7ae4d7697cf46d132ca9216c217a555cf53d30bc47af88323ceb9dfaac42dbf9e97753a9114fb1742709f60aab51
7
+ data.tar.gz: ee06ea290b341b2047676f5dd79de2165483f8522c05c6f438d920e94ddb85d9fef63ba4795c6539e10bfb6c7486db308597cdd87daa173358d2dcd7476103aa
@@ -1,7 +1,7 @@
1
1
  module Effective
2
2
  class Datatable
3
3
  attr_reader :attributes # Anything that we initialize our table with. That's it. Can't be changed by state.
4
- attr_reader :resource
4
+ attr_reader :effective_resource
5
5
  attr_reader :state
6
6
 
7
7
  # Hashes of DSL options
@@ -149,6 +149,14 @@ module Effective
149
149
  @dsl_tool ||= DatatableDslTool.new(self)
150
150
  end
151
151
 
152
+ def resource
153
+ @effective_resource
154
+ end
155
+
156
+ def fallback_effective_resource
157
+ @fallback_effective_resource ||= Effective::Resource.new('', namespace: controller_namespace)
158
+ end
159
+
152
160
  private
153
161
 
154
162
  def column_tool
@@ -43,7 +43,7 @@ module Effective
43
43
  Rails.logger.info "COLUMN TOOL: order_column #{column.to_s} #{direction} #{sql_column}" if EffectiveDatatables.debug
44
44
 
45
45
  if column[:sql_as_column]
46
- collection.order("#{sql_column} #{datatable.resource.sql_direction(direction)}")
46
+ collection.order("#{sql_column} #{datatable.effective_resource.sql_direction(direction)}")
47
47
  else
48
48
  Effective::Resource.new(collection)
49
49
  .order(column[:name], direction, as: column[:as], sort: column[:sort], sql_column: column[:sql_column], limit: datatable.limit)
@@ -13,9 +13,15 @@ module Effective
13
13
 
14
14
  private
15
15
 
16
+ def load_effective_resource!
17
+ @effective_resource = if active_record_collection?
18
+ Effective::Resource.new(collection_class, namespace: controller_namespace)
19
+ end
20
+ end
21
+
16
22
  # This looks at all the columns and figures out the as:
17
23
  def load_resource!
18
- @resource = Effective::Resource.new(collection_class, namespace: controller_namespace)
24
+ load_effective_resource!
19
25
 
20
26
  if active_record_collection?
21
27
  columns.each do |name, opts|
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '3.6.1'.freeze
2
+ VERSION = '3.6.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_datatables
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.1
4
+ version: 3.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect