I think there is another possibility.
First MWE (minimum working example) of your question:
require 'sequel' Sequel.extension :pretty_table
To enable ad_item with the parameter ( Wishlist#add_item(Item.create(descr: 'item 2'), facebook_id: 'fb2') ), you must define adder , as in this example:
require 'sequel' Sequel.extension :pretty_table Sequel::PrettyTable.print()/Sequel::PrettyTable.string() DB = Sequel.sqlite DB.create_table(:wishlists){ primary_key :id String :listname } DB.create_table(:items){ primary_key :id String :descr } DB.create_table(:items_wishlists){ primary_key :id foreign_key :wishlist_id, :wishlists foreign_key :item_id, :items add_column :facebook_id, type: :nvarchar } class Item < Sequel::Model
Result:
+-----------+--+-------+-----------+ |facebook_id|id|item_id|wishlist_id| +-----------+--+-------+-----------+ | | 1| 1| 1| |fb2 | 2| 2| 1| +-----------+--+-------+-----------+
But the following problem will come later:
With w1.items you get a list of items, but you do not have access to the parameters. (at least I have not found a way so far. I am still studying, but I expect that I need a join table model for this (see Jeremis recommendation))
source share