Created
September 20, 2012 01:10
-
-
Save gmcinnes/3753390 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource_fieldname = field.keys.first | |
resource_field = @resource.send(resource_fieldname) | |
resource_field_value = field.values.first | |
target = resource_field[resource_field_value] | |
# This if you don't care what it becomes if it's not an array previously | |
#target = agent.id if target.is_a? Array | |
# This if you always want it to end up as an array, even if it wasn't previously | |
#target = agent.id rescue target = [] | |
target.save |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment