Skip to content

Commit

Permalink
Support setting return_operation option globally
Browse files Browse the repository at this point in the history
  • Loading branch information
rschef committed May 8, 2020
1 parent cdac625 commit 3f6f896
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/paper_trail.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ defmodule PaperTrail do
return_operation: return_operation
]

@return_operation Application.get_env(:paper_trail, :return_operation, nil)

@default_opts [
repo: nil,
strict_mode: nil,
origin: nil,
meta: nil,
originator: nil,
prefix: nil,
return_operation: nil
return_operation: @return_operation
]

@type insert_opts :: [
Expand All @@ -56,7 +58,7 @@ defmodule PaperTrail do
prefix: nil,
model_key: :model,
version_key: :version,
return_operation: nil
return_operation: @return_operation
]

@callback insert(Ecto.Changeset.t(), insert_opts) :: {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()}
Expand Down

0 comments on commit 3f6f896

Please sign in to comment.