ruby on rails - Extracting all records from a model and getting them to add them up -


i have app order , part models (an order has_many parts). i'm trying put list of outstanding parts different orders can have same parts need remove duplicates while increasing totals. i've tried few ways can't head around @ moment

it seems want make has_many :through association.

the idea have 3 tables ex:

  • order
  • part
  • outstandingpart (example name)

outstandingpart, table holds connection between orders , parts while having additional details outstanding_date etc

have @ rails docs on 2.4 has_many :through association

some more links here , here


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -