Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions test/support/resources/post.ex
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ defmodule AshPostgres.Test.Post do

defaults([:read, :destroy])

read :with_version_check do
argument(:version, :integer)

filter(expr(type(^arg(:version), :string) in ["1", "2"]))
end

read :first_and_last_post do
prepare(fn query, _ ->
Ash.Query.combination_of(query, [
Expand Down
7 changes: 7 additions & 0 deletions test/type_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,11 @@ defmodule AshPostgres.Test.TypeTest do
assert %{x: 2.0, y: 3.0, z: 4.0} = p.db_string_point_id
assert %{x: 2.0, y: 3.0, z: 4.0} = p.db_string_point.id
end

test "casting integer to string works" do
Post |> Ash.Changeset.for_create(:create) |> Ash.create!()

post = Ash.Query.for_read(Post, :with_version_check, version: 1) |> Ash.read!()
refute is_nil(post)
end
end