0
issue = Redmine::Issue.find(1700)
ready = issue.custom_fields.select{|i| i.name == 'Ready for testing'}.first
issue.subject = 'test'
ready.value = "1"
issue.save

This grabs the ticket from redmine, and updates the subject accordingly, but not the custom fields.

issue.errors.full_messages is blank. issue.valid? is true. issue.save returns true (obviously since it is updating the subject). Is there something on the redmine side of things that's blocking me?

http://www.redmine.org/issues/6403 - is a good reference that seems to tell me this is fine. I'm on version 2.3.1.devel of redmine.

Saving ready gives the following. I think because it's just a subset of issue, right?

pry(main)> ready.save
ActiveResource::UnauthorizedAccess: Failed.  Response code = 401.  Response message = Unauthorized.
from /Users/brett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activeresource-3.2.18/lib/active_resource/connection.rb:132:in `handle_response'
Dudo
  • 4,002
  • 8
  • 32
  • 57
  • You save `issue` not `ready` (custom field). why not `ready.save`? – gotva May 20 '14 at 06:39
  • I added the results to my question... ready is just a hash inside of the `custom_fields` array of `issue`, though, so I'd think that saving `issue` will save `ready`. – Dudo May 20 '14 at 16:16
  • If you have not yet solved this: what type of field is 'Ready for testing'? If it is a list then the 'test' option needs to be available, otherwise your syntax is correct. You can also try issue.to_xml to see what you're posting. – Centimane Oct 07 '15 at 17:48

0 Answers0