app/models/effective/effective_datatable/resource.rb in effective_datatables-4.4.4 vs app/models/effective/effective_datatable/resource.rb in effective_datatables-4.4.5
- old
+ new
@@ -87,10 +87,10 @@
columns.each do |name, opts|
if opts[:as].kind_of?(Class) && opts[:as].ancestors.include?(ActiveRecord::Base)
opts[:resource] = Effective::Resource.new(opts[:as], namespace: controller_namespace)
opts[:as] = :resource
- elsif opts[:as] == nil
+ elsif opts[:as] == nil && row.present?
if (value = Array(row[opts[:index]]).first).kind_of?(ActiveRecord::Base)
opts[:resource] = Effective::Resource.new(value, namespace: controller_namespace)
opts[:as] = :resource
end
end