How do I pass params to Active Record Model has_many?

Hello everybody,

I have a model: account.rb, with has_many condition like this

has_many :purchases, -> { where(available: true, workspace_id: nil).order(id: :desc) }

Now I want to pass workspace_id params to has_many

How can I do it? I do research on GG but got nothing

Thanks,

I’m not sure that’s doable. You might find answers in the source code itself.

Line 1457