as title, I have product & order model with nested relationship, like:
resources :products do
resources :orders
end
Products has a filed, it name is 'amount', for example is 5.
how can I limit orders total counts less than or equal to 5?
I don't know how to use parent keyword in order model. Who can help me? thanks.
I need a resolution, thanks.