Project

General

Profile

Updating fixed_version via API when it's null

Added by Dinesh Than over 11 years ago

Hi,
I'm new to redmine and have been trying to figure out a way to update fixed_version. If the bug has a fixed version then I am able to update it, but when it doesn't how do I add a new fixed_version.name and fixed_version.id and associate to the issue. My code is below and would really appreciate some help with this.

require 'rubygems'
require 'active_resource'
require 'yaml'

class RestAPI < ActiveResource::Base
self.site = 'http://redmine.local'
self.user = 'dinesht'
self.password = 'abcdacbds'
self.format = :xml
end
class Project < RestAPI; end
class Issue < RestAPI; end

f = File.open('update.txt', 'w')

myIssue = Issue.find(6983)
f.write(YAML::dump(myIssue))
myIssue.fixed_version.name = '1.0.24.3'
myIssue.save