Skip to content

Instantly share code, notes, and snippets.

@sankalpk
Created July 4, 2018 16:15
Show Gist options
  • Save sankalpk/93823ed23d482469f4579a136fff4f9b to your computer and use it in GitHub Desktop.
Save sankalpk/93823ed23d482469f4579a136fff4f9b to your computer and use it in GitHub Desktop.
Convert form to form template in Cloverbook
email = "<INSERT_EMAIL_HERE>"
form_graph_id = "<INSERT_GRAPH_ID_HERE"
user = User.find_by_email
form = Form.find(GraphQL::Schema::UniqueWithinType.decode(form_graph_id)[1])
FormTemplate.create!(
user_id: user.id,
brand_id: user.primary_brand.id,
schema: form.schema,
ui_schema: form.ui_schema,
title: form.title,
description: form.description,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment