views:

284

answers:

1

I want to write a plugin for redmine that will depend on quite a few custom fields, so I would like to create the custom fields automatically. Ideally within the plugin code, or if not by a script I can run when I install the plugin - I really don't want to have to create 10+ fields through the web interface when I set this up, especially when one is a list with quite a few values.

Can anyone tell me if there are standard ways of doing this?

Also is there a good way to export the custom fields from an existing installation?

A: 

Custom fields essentially are pretty much implemented as a resource (however there is no resource route for custom_fields). I don't see a reason why you shouldn't be able to just use CustomField.create/new to create the fields your plugin needs. Likewise you should be able to just use find() to get all existing custom fields. However, I have to say that I have never done this before and don't know if this is the standard way. But, off the hand, I can't see anything wrong with doing it this way.

ajmurmann