0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-09-20 07:41:11 +02:00
discourse-custom-wizard/extensions/custom_field/preloader.rb
2020-11-09 17:50:17 +11:00

17 Zeilen
Kein EOL
415 B
Ruby

module CustomWizardCustomFieldPreloader
def preload_custom_fields(objects, fields)
if objects.present?
@cw_klass = objects.first.class.name.underscore
if cw_fields.any?
cw_fields.each do |field|
fields << field.name
end
end
end
super(objects, fields)
end
def cw_fields
@cw_fields ||= CustomWizard::CustomField.list_by(:klass, @cw_klass)
end
end