Skip to content

Commit

Permalink
fix: undo previous change for only_touched? on form submit
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Sep 18, 2023
1 parent 6d9a7d5 commit e39558a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
10 changes: 1 addition & 9 deletions lib/ash_phoenix/form/form.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1566,13 +1566,6 @@ defmodule AshPhoenix.Form do
type: {:fun, 1},
doc:
"A function to apply to the source (changeset or query) just before submitting the action. Must return the modified changeset."
],
only_touched?: [
type: :boolean,
default: false,
doc: """
If set to true, only fields that have been marked as touched will be used.
"""
]
]

Expand Down Expand Up @@ -1661,8 +1654,7 @@ defmodule AshPhoenix.Form do
end

changeset_params =
opts[:override_params] ||
params(form, only_touched?: Keyword.get(opts, :only_touched?, false))
opts[:override_params] || params(form)

prepare_source = form.prepare_source || (& &1)

Expand Down
1 change: 1 addition & 0 deletions lib/ash_phoenix/form/wrapped_value.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule AshPhoenix.Form.WrappedValue do
@moduledoc "A sentinal value used when editing a union that has non-map values"
use Ash.Resource,
data_layer: :embedded

Expand Down
9 changes: 6 additions & 3 deletions lib/ash_phoenix/gen/live.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
defmodule AshPhoenix.Gen.Live do
@moduledoc false

def generate_from_cli(argv) do
if Mix.Project.umbrella?() do
Mix.raise(
Expand Down Expand Up @@ -209,6 +211,7 @@ defmodule AshPhoenix.Gen.Live do
|> Ash.Resource.Info.public_attributes()
end

# sobelow_skip ["DOS.BinToAtom"]
defp action(resource, opts, type) do
action =
case opts[:"#{type}_action"] do
Expand Down Expand Up @@ -361,18 +364,18 @@ defmodule AshPhoenix.Gen.Live do
end
end

defp web_path() do
defp web_path do
web_module().module_info[:compile][:source]
|> Path.relative_to(root_path())
|> Path.rootname()
end

defp root_path() do
defp root_path do
Mix.Project.get().module_info[:compile][:source]
|> Path.dirname()
end

defp web_module() do
defp web_module do
base = Mix.Phoenix.base()

cond do
Expand Down
5 changes: 4 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ defmodule AshPhoenix.MixProject do

defp aliases do
[
docs: ["docs", "ash.replace_doc_links"]
docs: ["docs", "ash.replace_doc_links"],
sobelow:
"sobelow --skip -i Config.Secrets --ignore-files lib/ash_phoenix/gen/live.ex"

]
end
end
1 change: 1 addition & 0 deletions test/support/resources/foo.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule AshPhoenix.Test.Foo do
@moduledoc false
use Ash.Resource, data_layer: :embedded

attributes do
Expand Down
1 change: 1 addition & 0 deletions test/support/resources/union_value.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule AshPhoenix.Test.UnionValue do
@moduledoc false
use Ash.Type.NewType,
subtype_of: :union,
constraints: [
Expand Down

0 comments on commit e39558a

Please sign in to comment.