Skip to content

Instantly share code, notes, and snippets.

@keslert

keslert/seeds.ex Secret

Created January 23, 2016 23:11
Show Gist options
  • Save keslert/c93e46def689e79ca8d5 to your computer and use it in GitHub Desktop.
Save keslert/c93e46def689e79ca8d5 to your computer and use it in GitHub Desktop.
# seeds.ex
_book = %{title: "Tea Rex", uuid: "7dd77fa0-ba25-11e5-a54b-3c15c2ddf318", image: "tea_rex.jpeg?63619929809"}
book = Book.changeset(%Book{}, Map.take(_book, ~w(title uuid)a))
|> Ecto.Changeset.change(image: _book.image) |> Repo.insert!
# Error
no function clause matching in Arc.Ecto.Type.dump/2
lib/arc_ecto/type.ex:19: Arc.Ecto.Type.dump(Project.BookImage, "tea_rex.jpeg?63619929809")
(ecto) lib/ecto/query/planner.ex:29: anonymous fn/6 in Ecto.Query.Planner.fields/4
(stdlib) lists.erl:1262: :lists.foldl/3
(ecto) lib/ecto/query/planner.ex:21: Ecto.Query.Planner.fields/4
(ecto) lib/ecto/repo/schema.ex:449: Ecto.Repo.Schema.dump_changes/5
(ecto) lib/ecto/repo/schema.ex:77: anonymous fn/11 in Ecto.Repo.Schema.do_insert/4
(ecto) lib/ecto/repo/schema.ex:477: anonymous fn/3 in Ecto.Repo.Schema.wrap_in_transaction/9
(ecto) lib/ecto/pool.ex:292: Ecto.Pool.with_rollback/3
(ecto) lib/ecto/adapters/sql.ex:582: Ecto.Adapters.SQL.transaction/8
(ecto) lib/ecto/pool.ex:244: Ecto.Pool.outer_transaction/6
(ecto) lib/ecto/adapters/sql.ex:551: Ecto.Adapters.SQL.transaction/3
(ecto) lib/ecto/repo/schema.ex:14: Ecto.Repo.Schema.insert!/4
priv/repo/seeds.exs:25: anonymous fn/2 in :elixir_compiler_1.__FILE__/1
(elixir) lib/enum.ex:1387: Enum."-reduce/3-lists^foldl/2-0-"/3
priv/repo/seeds.exs:22: (file)
(elixir) lib/code.ex:363: Code.require_file/2
(mix) lib/mix/tasks/run.ex:68: Mix.Tasks.Run.run/1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment