Here is
Police has many products
Police has many transactions
Products has many transactions
I need to get a transaction with the combination of police and product.
Is it feasible to defines associations to do that. I know that's weird
a bit. I think I'm missing a model in between.
Rémi
--
Posted via http://www.ruby-forum.com/.
> I think the design is fine, actually. If I understand correctly, your
> transactions table has columns police_id and product_id (and others).
>
> If so, you can find a transaction this way:
>
> Transaction.find_by_police_and_product(police, product)
>
> This will return the first one that matches. You can also add further
> conditions, ordering, etc. as with any other find.
>
> Jeff
>
> www.purpleworkshops.com
I was not very clear in my question.
I would like to do Police.transaction but in conjunction with Product.
But anyway today we redesign our model to make it cleaner.
Thanks for your help.
Rémi
Jeff Cohen wrote:
> On Dec 5, 7:26�am, R�mi Gagnon <rails-mailing-l...@andreas-s.net>
--
Posted via http://www.ruby-forum.com/.