I am using the restforce gem to push data to salesforce once an object is saved in my rails application. Everything is working fine but in the process of making my code DRY, I encountered an issue. I have a group of fields that I am submitting with every object I save. However, depending on the object type I want to submit other fields. I'm not sure how to set a group of field mappings to a variable.
I'm not getting any errors in the console but nothing is pushing to salesforce.
constant_fields = Name: object.name, Email: object.email
if object.type == "car"
car_fields = Wheel_Size__c: object.wheel_size, Colour__c: object.car_colour)
plane_fields = Wing_Span__c: object.wing_span, Tail_Number__c: object.tail_number