Enum? polymorphic?


I have two tables namely, liquids and unit,

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

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


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


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

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

 layout 'activescaffold'


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