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 sequel-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/a6fb3325-6f22-4752-9fb0-fdab2851ca45n%40googlegroups.com.

Reply via email to