Redmine - Ruby - 寻找自定义字段的值
我检查了 IRC 的 redmine,但无法获得帮助。 我很矛盾,不知道该把这个问题放在 Superuser、ServerFault 还是这里,但由于我的问题是面向技术编程的,所以我决定在这里寻求帮助。
我们有一个 Mercurial 存储库系统,其布局基于满足我们需求的项目。我编写了一些 shell 脚本,它们可以很好地管理存储库并将它们放在正确的位置等。我试图调用这些脚本并从 Redmine 向它们传递参数。我正在编辑 app/controllers/projects_controller.rb (第 75 行 -> 87 行)
我已设法提取项目参数和当前用户,但我添加了两个自定义字段(使用 Redmine 管理中的自定义字段)并且我我正在尝试访问这些自定义字段的值。有谁知道我怎样才能得到这些?
我当前的工作测试声明如下:
system "echo '#{@project.identifier}, #{User.current}' >> /tmp/rm.log"
I checked IRC for redmine and was unable to get help.
I was conflicted on weather to stick this on Superuser, ServerFault or here, but as my problem is technically programming oriented I decided to look for help here.
We have a Mercurial repository system with a layout based on projects that addresses our needs. I wrote some shell scripts which work delightfully to manage the repository and put them in correct places etc. I am trying to call these scripts and pass them parameters from Redmine. I am editing the app/controllers/projects_controller.rb (lines 75 -> 87)
I have managed to pull the project parameters and current user, but I have two custom fields I added (using the custom fields in Redmine Administration) and I am trying to access the values of these custom fields. Does anyone have any idea how I can get these?
My current working test statement is below:
system "echo '#{@project.identifier}, #{User.current}' >> /tmp/rm.log"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 CustomField 模型。例如,
为了弄清楚这一点,我刚刚安装了 Redmine-1.0.0 并浏览了源代码和脚本/控制台。
Use the CustomField model. For example,
To figure this out, I just installed Redmine-1.0.0 and poked around in the source and the script/console.
调用上面的脚本(而不是在原始脚本中回显),然后传入我们已有的项目标识符,自定义参数可以以任何方式使用。此代码用于获取单个自定义字段(我只使用了一个。)
Calling the above script (instead of echoing in the original), and then passing in the project identifier which we already have, the custom parameter can be used in whatever way nessacary. This code it to grab a single custom field (i was only using one.)