Question

I'm looking for a way to modify the values of Custom fields (called subject_fields in the Highrise API somewhat confusingly).

The Ruby wrapper 37signals recommends does not support these custom fields.

I found a fork that has been updated more recently and I've been able to get sort of working:

p = Highrise::Person.find_all_across_pages(:params => {:name => "John"}).last
print p.name # outputs, John Smith, which is what I want.

I have a custom field called "Measurements".

This works:

p.subject_data_hash # outputs {"measurements"=>"5 feet"}

However, when I try to access only this value with p.field("Measurements") (I also tried "measurements", I get <Highrise::SubjectData:0x007fb059b6be10>, with none of the @attributes that contain the data I'm looking for.

Needless to say, I can't modify the values if I can't access them.

How can I access and modify the values of custom fields in Ruby with the Highrise API?

Was it helpful?

Solution

To get the value:

 p.field("measurements").value

To set the value:

 p.set_field_value("measurements", "5 feet")
 p.save
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top