Skip to content

Instantly share code, notes, and snippets.

@SidneyAllen
Created September 30, 2021 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SidneyAllen/09549e339d289fb58987f0a5a28b277f to your computer and use it in GitHub Desktop.
Save SidneyAllen/09549e339d289fb58987f0a5a28b277f to your computer and use it in GitHub Desktop.
Letters = new Letter_model_class()
New_letter = { id: ’123’, to: ‘addr_id1’, from: ‘addr_id2’ }
If Letters.json_attr EXISTS && Letters.jsonb_attr EXISTS:
New_letter.json_attr = { name: ‘doug’ }
New_letter.jsonb_attr = { name: ‘doug’ }
ELSE:
New_letter.json_attr= { name: ‘doug’ }
Letters.save(New_letter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment