码迷,mamicode.com
首页 > 其他好文 > 详细

Redmine开发帮助

时间:2016-07-03 11:46:52      阅读:418      评论:0      收藏:0      [点我收藏+]

标签:

这里先零星记录二次开发用得上的知识点:

1、获取自定义内容,参考此文

Every customizable redmine object has custom_field_values field, that value is array ofCustomFieldValueCustomFieldValue 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

 

Redmine开发帮助

标签:

原文地址:http://www.cnblogs.com/lustforlife/p/5637761.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!