-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9bc13e2
commit 6681c06
Showing
7 changed files
with
103 additions
and
4 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
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
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
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
21 changes: 21 additions & 0 deletions
21
test/support/models/not_polymorphic/reminder/context/device_no_id.ex
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,21 @@ | ||
defmodule PolymorphicEmbed.Regular.Reminder.Context.DeviceNoId do | ||
use Ecto.Schema | ||
import Ecto.Changeset | ||
|
||
@primary_key false | ||
|
||
embedded_schema do | ||
field :ref, :string | ||
field :type, :string | ||
|
||
embeds_one :extra, Extra do | ||
field :imei, :string | ||
end | ||
end | ||
|
||
def changeset(struct, params) do | ||
struct | ||
|> cast(params, ~w(ref type)a) | ||
|> validate_required(~w(type)a) | ||
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
21 changes: 21 additions & 0 deletions
21
test/support/models/polymorphic/reminder/context/device_no_id.ex
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,21 @@ | ||
defmodule PolymorphicEmbed.Reminder.Context.DeviceNoId do | ||
use Ecto.Schema | ||
import Ecto.Changeset | ||
|
||
@primary_key false | ||
|
||
embedded_schema do | ||
field :ref, :string | ||
field :type, :string | ||
|
||
embeds_one :extra, Extra do | ||
field :imei, :string | ||
end | ||
end | ||
|
||
def changeset(struct, params) do | ||
struct | ||
|> cast(params, ~w(ref type)a) | ||
|> validate_required(~w(type)a) | ||
end | ||
end |