New Discussion

Notifications

You’re not receiving notifications from this thread.

How do I pass params to Active Record Model has_many?

0
Rails

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,

Join the discussion
Create an account Log in

Learning Ruby on Rails? Join our newsletter.

We won't send you spam. Unsubscribe at any time.