dwyl / phoenix-ecto-append-only-log-example

📝 A step-by-step example/tutorial showing how to build a Phoenix (Elixir) App where all data is immutable (append only). Precursor to Blockchain, IPFS or Solid!
GNU General Public License v2.0
78 stars 7 forks source link

`require Ecto.Query` must appear earlier #18

Closed geekoftheweek closed 5 years ago

geekoftheweek commented 5 years ago

In 4.3 Update when get(id) is first changed to get(entry_id), the use of from/2 causes compilation errors unless Ecto.Query is required and imported. This require and import gets added later in 4.4 Get History, but running into these unexpected error messages was very confusing for me as an Elixir n00b trying to follow along.

mischa-s commented 5 years ago

Ran into this today. To clarify the compile error is cannot use ^entry_id outside of match clauses on 4.3, solution is

/append_only_log.ex

  alias Append.Repo
  require Ecto.Query
...
  defmacro __before_compile__(_env) do
    quote do
      import Ecto.Query
...
bmartin2015 commented 5 years ago

This issue was resolved in https://github.com/dwyl/phoenix-ecto-append-only-log-example/pull/24

nelsonic commented 5 years ago

@bmartin2015 thanks again for the PR! 🎉 (closing this issue. if still required, please re-open with comment) 👍