ash-project / ash

A declarative, extensible framework for building Elixir applications.
https://www.ash-hq.org
MIT License
1.59k stars 213 forks source link

many_to_many does not respect filter on join_relationship #1192

Open barnabasJ opened 4 months ago

barnabasJ commented 4 months ago

Describe the bug A clear and concise description of what the bug is.

I have this many_to_many definition

    has_many :invoicing_files_references, FileReference do
      public? true
      filter expr(category == :invoicing)
    end

    many_to_many :invoicing_files, File do
      through FileReference
      join_relationship :invoicing_files_references
      public? true
    end

But the resulting SQL query for the join_relationship does not include the filter

To Reproduce A minimal set of resource definitions and calls that can reproduce the bug.

Expected behavior A clear and concise description of what you expected to happen.

It should add the filter to the SQL query for the join relationship

Runtime

Additional context Add any other context about the problem here.

zachdaniel commented 4 months ago

hm...is there perhaps a specific case where this doesn't work? I've added a test in ash_postgres showing that its working.

barnabasJ commented 4 months ago

Hmm, I will try and recreate it then. But I didn't have anything special configured on the relationship

On Wed, 22 May 2024, 23:22 Zach Daniel, @.***> wrote:

hm...is there perhaps a specific case where this doesn't work? I've added a test in ash_postgres showing that its working.

— Reply to this email directly, view it on GitHub https://github.com/ash-project/ash/issues/1192#issuecomment-2125776421, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZBCTOJAYSVIOOLITQ63LDZDUEB5AVCNFSM6AAAAABIDCJQDOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRVG43TMNBSGE . You are receiving this because you authored the thread.Message ID: @.***>

zachdaniel commented 4 months ago

It is possible (but unlikely) that something else I've done has fixed it also.