Skip to content

Instantly share code, notes, and snippets.

@janjiss
Last active August 29, 2015 14:23
Show Gist options
  • Select an option

  • Save janjiss/cfb04147825839ea7aa1 to your computer and use it in GitHub Desktop.

Select an option

Save janjiss/cfb04147825839ea7aa1 to your computer and use it in GitHub Desktop.
{:ok, users_json} = File.read("users.json")
{:ok, users_parsed} = JSX.decode(users_json, [{:labels, :atom}])
Enum.map(users_parsed, fn(e)-> %User{username: e.username, password_digest: e.password_digest, email: e.email} end) |>
Enum.each(fn(e)-> Repo.insert!(e, false) end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment