Project

General

Profile

Rest API for Ruby doesn't update custom_fields.

Added by Guilherme Noronha over 11 years ago

Hello everybody,

I'm not sure if the right place to post my question is here or in the development forum, but let's go.

I have to update a custom_field named as Changelog on a issue in my private redmine. For reach this I'm using the "Rest API with redmine" which tutorial I found on these sites: http://www.redmine.org/projects/redmine/wiki/Rest_api_with_ruby and http://www.redmine.org/issues/6403.

So, i tried every code listed above on these sites and none of them was able to update my issue. The issue doesn't update for any reason I didn't figured out. Below an example of my code:

require 'rubygems'
require 'active_resource'

class Issue < ActiveResource::Base
  self.site = 'http://net1/redhomolog'
  self.user = 'my_user'
  self.password = 'my_pass'
end

def atualiza_changelog(numero_tarefa, changelog)
  issue = Issue.find(numero_tarefa.to_i)
  issue.custom_fields[7].value = changelog.to_s
  puts issue.save
end

Some remarks:

  • issue.custom_fields(7).value returns to me the prior value established on issue which proves the code works to retrieve some information.
  • I'm able to update another fields of the issue like subject or description.
  • In attachments there is a picture of my redmine issue configuration.

Thank you everybody.