effective_datatables 2.6.14 → 2.6.15

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
  SHA1:
3
- metadata.gz: e74b48943a26fed6030dccee8555337684bc4c49
4
- data.tar.gz: ef20573e54accb0e2135e66a6c9f77a8720c51af
3
+ metadata.gz: 9d928965ede9ce8dfc004b6f2653cac420eee7c6
4
+ data.tar.gz: b1612ccf4823b60f283d4c7f885b4b1224774dd4
5
5
  SHA512:
6
- metadata.gz: 01980cdb85274c5cf73a7131bbbe8ef9b1873930eb61a03b23bcec45b62e97f4c79bd3e59c9fa298306da752de323127cf556670fe351de2e69f77f33c516ff7
7
- data.tar.gz: b163136bc40e04ec0cc698b9ff20c58e97402573071ee47a67513d710140fbb00e031e5388b9c34a1140af4a232d3751fccb3823aa239406551b43f3614f078b
6
+ metadata.gz: 7f26405d6274b823095d11290b1573114ace9ba17b386f59658b31d6fc27b9025bd3b04a24e9360f9e44700bcaa739edcca138f6686ac0cd365947f17b7ecb83
7
+ data.tar.gz: 4b622c39357d491f66baac5e773b86e0cfb0bd9ca98f4e80e8632771d8ea96febc437bd749f0819d8765b92915d7a0e9029acf00c0f61f77123a90b54eea0709
@@ -146,7 +146,8 @@ module Effective
146
146
  cols[name][:column] = sql_table.present? ? "#{quote_sql(sql_table.name)}.#{quote_sql('roles_mask')}" : name
147
147
  end
148
148
 
149
- if sql_table.present? && sql_column.blank? && !cols[name][:array_column] # This is a SELECT AS column, or a JOIN column
149
+ # This is a SELECT AS column, or a JOIN column or a delegated object
150
+ if sql_table.present? && sql_column.blank? && !cols[name][:array_column]
150
151
  cols[name][:sql_as_column] = true
151
152
  end
152
153
 
@@ -118,7 +118,7 @@ module Effective
118
118
  elsif obj.kind_of?(Array) # Array backed collection
119
119
  obj[opts[:array_index]]
120
120
  elsif opts[:sql_as_column]
121
- obj[name]
121
+ obj[name] || obj.send(name)
122
122
  else
123
123
  obj.send(name)
124
124
  end
@@ -219,8 +219,6 @@ module Effective
219
219
  def add_actions_column_locals(locals)
220
220
  return unless active_record_collection?
221
221
 
222
- # Consider authorization levels first
223
-
224
222
  if locals[:show_action] == :authorize
225
223
  locals[:show_action] = (EffectiveDatatables.authorized?(controller, :show, collection_class) rescue false)
226
224
  end
@@ -244,6 +242,7 @@ module Effective
244
242
  begin
245
243
  resource = collection_class.new(id: 123)
246
244
  resource.define_singleton_method(:persisted?) { true } # We override persisted? to get the correct action urls
245
+ raise 'no to param' unless resource.to_param.present?
247
246
  rescue => e
248
247
  return
249
248
  end
@@ -261,7 +260,7 @@ module Effective
261
260
 
262
261
  # So if we have a URL, this is an action we can link to
263
262
  if url
264
- locals[:show_path] = url.gsub('123', ':to_param')
263
+ locals[:show_path] = url.gsub("/#{resource.to_param}", '/:to_param')
265
264
  else
266
265
  locals[:show_action] = false
267
266
  end
@@ -280,7 +279,7 @@ module Effective
280
279
 
281
280
  # So if we have a URL, this is an action we can link to
282
281
  if url
283
- locals[:edit_path] = url.gsub('123', ':to_param')
282
+ locals[:edit_path] = url.gsub("/#{resource.to_param}", '/:to_param')
284
283
  else
285
284
  locals[:edit_action] = false
286
285
  end
@@ -299,7 +298,7 @@ module Effective
299
298
 
300
299
  # So if we have a URL, this is an action we can link to
301
300
  if url
302
- locals[:destroy_path] = url.gsub('123', ':to_param')
301
+ locals[:destroy_path] = url.gsub("/#{resource.to_param}", '/:to_param')
303
302
  else
304
303
  locals[:destroy_action] = false
305
304
  end
@@ -319,7 +318,7 @@ module Effective
319
318
 
320
319
  # So if we have a URL, this is an action we can link to
321
320
  if url
322
- locals[:unarchive_path] = url.gsub('123', ':to_param')
321
+ locals[:unarchive_path] = url.gsub("/#{resource.to_param}", '/:to_param')
323
322
  else
324
323
  locals[:unarchive_action] = false
325
324
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '2.6.14'.freeze
2
+ VERSION = '2.6.15'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_datatables
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.14
4
+ version: 2.6.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-03 00:00:00.000000000 Z
11
+ date: 2016-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails