-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use association id as defined on the schema
Problem: - current implementation works based on convention, that association names always follow the pattern "#{association_name}_id". This is not always the case Solution: - use the information on schema for that association to get the owner key
- Loading branch information
1 parent
0aa6d7b
commit 7c67047
Showing
3 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
priv/test_repo/migrations/20151111000420_create_company_account.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
defmodule ExMachina.TestRepo.Migrations.CreateCompanyAccount do | ||
use Ecto.Migration | ||
|
||
def change do | ||
create table(:company_accounts) do | ||
add :name, :string | ||
add :manager_id, :integer | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters