Suppose I have two schemas, Property, and User.
schema "property" do belongs_to :owner, User, [foreign_key: :owner_id] end schema "user" do has_many :property, Property, [references: :owner_id] end
create table(:user) do end create table(:property) do add :owner_id, references(:user) end
When I recompile at the repl, I get
== Compilation error in file lib/app/accounts/user.ex ==
** (ArgumentError) schema does not have the field :owner_id used by association :property, please set the :references option accordingly