enum? polymorphic?

hi

I have two tables namely, liquids and unit,

in unit there is :name,:string which store various unit, e.g. L mL Sv mm

in liquids, there are :liquidA, :integer :liquidAunit, :string :liquidB, :integer :liquidBunit, :string

how should I define the relation between the two table, so that liquid will display the unit name of A and B respectively

Can a liquid have more than one unit?

if not it is simple

liquid belongs_to :unit with a unit_id in the table, instead of the :liquidAunit, :string

in a liquid table , there are many liquid and each liquid has one unit.

Thank you Paul. I have achieve what I want by following Ruby Programming

Great!

Can you please paste your association? I would like to see how you solved it and make sure I understood your initial requirement.

regards Ivor

I have followed exactly the example in

And I am using Activescaffold.

The field has been reconfig as follow

class CustomerController < ApplicationController    active_scaffold :customer do |config|      config.columns[:billing_address].ui_type = :select      config.columns[:shipping_address].ui_type = :select     end

     layout 'activescaffold' end

So in my real implementation, Customer => liquid Address => unit