Tony1
(.Tony.)
September 13, 2007, 3:12am
1
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
Ivor_Paul
(Ivor Paul)
September 13, 2007, 4:15am
2
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
Tony1
(.Tony.)
September 13, 2007, 4:18am
3
in a liquid table , there are many liquid and each liquid has one
unit.
Tony1
(.Tony.)
September 13, 2007, 4:55am
4
Thank you Paul.
I have achieve what I want by following Ruby Programming
Ivor_Paul
(Ivor Paul)
September 13, 2007, 6:13am
5
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
Tony1
(.Tony.)
September 13, 2007, 6:44am
6
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