Project

General

Profile

Actions

Patch #15277

closed

Accept custom field format added at runtime

Added by Boris Bera about 11 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Normal
Category:
Custom fields
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

The CustomField model has a validation for the field_format attribute. This validation makes sure that the given field_format is part of the list of registered field formats.

There's a bug in the validation. The list the field format is checked against doesn't get updated when a new field format is added. This is probably because rails caches the list instead of accessing the reference and getting the updated version every time.

This becomes a problem for plugin developers. When a plugin registers a field format, all the custom fields using their formats will be invalid. Strangely enough, this doesn't seem to always happen. The same plugin running on the same version of redmine (2.3.3) on two different machines doesn't always have this bug. One version running on a mac in the development environment doesn't have this problem while another running on debian 7 in the production environment does have this problem.

This patch fixes the problem by wrapping the array of valid formats in a proc so that the updated version is used every time.


Files

Actions

Also available in: Atom PDF