On Wednesday, August 14, 2013 7:50:17 AM UTC-7, shreko wrote: > > This is second time I'm struggling with this, first time I worked around > by manual sql, this time I'm asking for help as I'm not sure what's Sequel > best practice for this. > > I have a model ShopSupplies with fields :id, :part_number, :units_in_stock > and :shop_supplies_cat_id > Second table is ShopSuppliesCat with :id, :name > > In the index list for Shop Supplies I'm trying to join Category table so I > can list the :name of the category > > @shop_supplies = ShopSupply.join(:shop_supplies_cats, :id => > :shop_supplies_cat_id) > > With this the :id field of the Dataset row becomes the :id field of the > ShopSupplyCat and I loose a reference to the ShopSupply :id field >
You need to explicitly select the columns you want (you are currently selecting *, or all columns from all tables). Add .select_all(:shop_supplies).select_more(:shop_supplies_cats__name___cat_name) to the dataset. Thanks, Jeremy -- 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 post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/groups/opt_out.
