PolyAmory (Ecto Poly v1.0.8) View Source

Creates a polymorphic embedded type

Link to this section Summary

Functions

Arguments

  • types: Keyword list of {name, type}. The name is stored in the database in order to identify what type to use in runtime.
  • type_field: Name of the field used to the type of that particular object. Default is :__type__.

Example

defmodule PolyAmory.TestChannelData do
  use PolyAmory, types: [
    sms: TestSmsChannel,
    email: TestEmailChannel,
  ]
end

Casts the given poly with the changeset parameters.

Link to this section Functions

Link to this macro

__using__(opts)

View Source (macro)

Arguments

  • types: Keyword list of {name, type}. The name is stored in the database in order to identify what type to use in runtime.
  • type_field: Name of the field used to the type of that particular object. Default is :__type__.

Example

defmodule PolyAmory.TestChannelData do
  use PolyAmory, types: [
    sms: TestSmsChannel,
    email: TestEmailChannel,
  ]
end
Link to this function

cast(changes, key, typename, opts \\ [])

View Source

Specs

Casts the given poly with the changeset parameters.

Link to this function

transform_load(type, value)

View Source