To me, that seems like you'd want a separate model, not a join table. - Rob
On Saturday, September 4, 2021 at 5:41:11 PM UTC-7 John Knapp wrote: > I have a standard many_to_ many with a model for the join table. The join > table has an extra attribute, "quantity". > > class Plan < Sequel::Model > many_to_many :capabilities > end > > # join table with extra column "quantity" > class CapabilitiesPlans < Sequel::Model > end > > class Capability < Sequel::Model > many_to_many :plans > end > > I can create the join record directly but that doesn't feel like the > sequel way. > CapabilitiesPlans.create(capability_id: c.id, plan_id: p.id, > quantity:5) > > But how can I modify this syntax to add quantity? > p.add_capability(c) > How to add the extra attribute using the add_*association* method? > > These two don't work: > p.add_capability(c).quantity(5) > p.add_capability(c, quantity: 5) > > I feel I must be missing something obvious but I've studied the docs and > posts on here and have struck out! > > I'd be happy to author documentation for this once I learn. > > --JK > -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sequel-talk/345b398f-154a-4308-ad97-7a1a1185a2ecn%40googlegroups.com.
