Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi example in the Contexts doc might be outdated #3438

Closed
karloescota opened this issue Jun 8, 2019 · 1 comment · Fixed by #3440
Closed

Multi example in the Contexts doc might be outdated #3438

karloescota opened this issue Jun 8, 2019 · 1 comment · Fixed by #3440

Comments

@karloescota
Copy link

Environment

  • Elixir version (elixir -v): Elixir 1.8.2 (compiled with Erlang/OTP 20)
  • Phoenix version (mix deps): locked at 1.4.6 (phoenix)
  • NodeJS version (node -v):
  • NPM version (npm -v):
  • Operating system:

Code in the documentation for Contexts under Strategies for cross-context workflows possibly outdated.

Was getting a failing test case at the latter part of the doc, the one with the Multi implementation.

Error:
** (FunctionClauseError) no function clause matching in Ecto.Multi.run/3

I checked the Multi.run doc and it says

receives the repo as the first argument, and the changes so far as the second argument

I updated the run code to Multi.run(:user, fn _, _ -> Accounts.create_user(params) end)
and it works.

Expected behavior

def register_account(attrs) do
  Multi.new()
  |> Multi.run(:account, fn _, _ ->
    IO.puts "do something here"
  end)
end

Screenshot 2019-06-09 at 12 49 50 AM

Actual behavior

def register_account(attrs) do
  Multi.new()
  |> Multi.run(:account, fn _ ->
    IO.puts "do something here"
  end)
end

Screenshot 2019-06-09 at 12 41 41 AM

Thank you!

@wojtekmach
Copy link
Contributor

Good catch. Passing a 1-arity function to Multi.run was deprecated in Ecto 3.0 and removed in Ecto 3.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants