diff --git a/lib/trestle/table/automatic.rb b/lib/trestle/table/automatic.rb index 03c04378..14d29f67 100644 --- a/lib/trestle/table/automatic.rb +++ b/lib/trestle/table/automatic.rb @@ -10,7 +10,7 @@ def columns end def content_columns - admin.default_table_attributes.map.with_index do |attribute, index| + attributes.map.with_index do |attribute, index| case attribute.type when :association Column.new(attribute.association_name, sort: false) @@ -30,6 +30,17 @@ def content_columns def actions_column ActionsColumn.new end + + private + def attributes + admin.default_table_attributes.reject { |attribute| + exclude?(attribute.name) + } + end + + def exclude?(field) + Array(options[:exclude]).include?(field) + end end end end