Fix #5005: Export time attributes as HTML attributes

* `float` is used for MediaAsset durations.
* `interval` is used for Ban durations.
* `uuid` is used for GoodJob IDs.
* `datetime` is used for created_at/updated_at timestamps. The format is
  `2022-02-04 08:33:36 -0800`.
This commit is contained in:
evazion
2022-02-10 11:04:37 -06:00
parent 9117ce9225
commit 76d2ee3220

View File

@@ -78,7 +78,7 @@ class ApplicationPolicy
# in tables and in the <body> tag on show pages.
def html_data_attributes
data_attributes = record.class.columns.select do |column|
column.type.in?([:integer, :boolean]) && !column.array?
column.type.in?(%i[integer boolean datetime float uuid interval]) && !column.array?
end.map(&:name).map(&:to_sym)
api_attributes & data_attributes