-   Notifications  
You must be signed in to change notification settings  - Fork 60
 
Closed
Description
Given:
defmodule CMS.Page do use Ecto.Schema import Ecto.Changeset schema "pages" do field :rendered, :string field :slug, :string field :title, :string field :published, :boolean, default: false field :published_at, :naive_datetime timestamps() end @doc false def changeset(page, attrs) do page |> cast(attrs, [:title, :slug, :rendered]) |> validate_required([:title, :slug, :rendered]) |> unique_constraint(:slug) end endAnd the following data in the db:
INSERT INTO "pages" ("id", "title", "slug", "rendered", "inserted_at", "updated_at", "published", "published_at") VALUES ('1', 'Hello, world', 'hello-world', '<p>You wat <em>mate</em></p>', '2020-10-10 10:10:10', '2020-10-10 10:10:10', '0', NULL); The following will fail:
> Repo.all(Pages) no function clause matching in Calendar.ISO.parse_naive_datetime/1 Called with 1 arguments :undefined Attempted function clauses (showing 2 out of 2) def parse_naive_datetime(<<"-", string::binary()>>) when is_binary(string) def parse_naive_datetime(string) when is_binary(string) This is called from exqlite.ex:186:
 defp naive_datetime_decode(val) do case NaiveDateTime.from_iso8601(val) do {:ok, dt} -> {:ok, dt} _ -> :error end endMetadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working