preload category custom fields

This commit is contained in:
Angus McLeod 2019-03-19 12:22:06 +11:00
parent c857e020a2
commit b7ee6a1b25
1 changed files with 15 additions and 0 deletions

View File

@ -115,6 +115,21 @@ after_initialize do
end end
end end
[
'donations_cause',
'donations_total',
'donations_month',
'donations_backers',
'donations_show_amounts',
'donations_maintainers',
'donations_maintainers_label',
'donations_github',
'donations_meta'
].each do |key|
Site.preloaded_category_custom_fields << key if Site.respond_to? :preloaded_category_custom_fields
end
add_to_serializer(:basic_category, :donations_cause) { object.donations_cause } add_to_serializer(:basic_category, :donations_cause) { object.donations_cause }
add_to_serializer(:basic_category, :donations_total) { object.donations_total } add_to_serializer(:basic_category, :donations_total) { object.donations_total }
add_to_serializer(:basic_category, :include_donations_total?) { object.donations_show_amounts } add_to_serializer(:basic_category, :include_donations_total?) { object.donations_show_amounts }