app/datatables/olivander/datatable.rb in five-two-nw-olivander-0.1.2.36 vs app/datatables/olivander/datatable.rb in five-two-nw-olivander-0.1.2.37

- old
+ new

@@ -13,20 +13,26 @@ end link_to r.send(field), send(path, args) end end - def self.auto_datatable(klazz, collection: nil, link_path: nil, only: [], except: [], hide: [], show: [], order_by: []) + def self.auto_datatable(klazz, collection: nil, link_path: nil, only: [], except: [], hide: [], show: [], order_by: [], scopes: []) Rails.logger.debug "initializing datatable for #{klazz}" klazz_attributes = klazz.new.attributes.collect{ |x| x[0] } column_attributes = klazz_attributes column_attributes &&= only if only.size.positive? column_attributes -= except if except.size.positive? resources_sym = klazz.table_name.to_sym bulk_action_list = self::ROUTE_BUILDER.resources[resources_sym]&.datatable_bulk_actions || [] default_hidden = %w[id created updated created_at updated_at deleted_at current_user current_action] + + filters do + scopes.each do |s| + scope s + end + end collection do dc = collection.nil? ? klazz.all : collection attributes.each do |att|