标签:
这里先零星记录二次开发用得上的知识点:
1、获取自定义内容,参考此文:
Every customizable redmine object has
custom_field_values
field, that value is array ofCustomFieldValue
. CustomFieldValue contains current value, custom field description and customized object.Needed values i reads and alters by sort out. May be it‘s not best variant, but i acquainted with ruby language not so long ago.
Method for reading custom fields values:
def object_custom_field_value(object, field_name) object.custom_field_values.each do |field| if field.custom_field.name == field_name return field.value end end end
And for changing:
def object_custom_field_set_value(object, field_name, value) object.custom_field_values.each do |field| if field.custom_field.name == field_name field.value = value end end end
标签:
原文地址:http://www.cnblogs.com/lustforlife/p/5637761.html