Skip to content

Instantly share code, notes, and snippets.

@pareeohnos
Created January 11, 2017 09:58
Show Gist options
  • Save pareeohnos/1d49737ac7dbaecbdf63e02648529b0f to your computer and use it in GitHub Desktop.
Save pareeohnos/1d49737ac7dbaecbdf63e02648529b0f to your computer and use it in GitHub Desktop.
defmodule Models.MyModel do
schema "models" do
...
belongs_to :assoc, Models.Assoc, type: :string, foreign_key: :assoc
end
end
== Compilation error on file lib/core/models/my_model.ex ==
** (ArgumentError) foreign_key :assoc must be distinct from corresponding association name
lib/ecto/schema.ex:1183: Ecto.Schema.__belongs_to__/4
lib/core/models/my_model.ex:24: (module)
(stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment