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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 On 9/13/07, .Tony. <thetonyest-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > 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 > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
in a liquid table , there are many liquid and each liquid has one unit. On Sep 13, 12:15 pm, "Ivor Paul" <ivorp...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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 > > On 9/13/07, .Tony. <thetony...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > 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--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thank you Paul. I have achieve what I want by following http://ruby.about.com/b/a/000069.htm On Sep 13, 12:18 pm, ".Tony." <thetony...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> in a liquid table , there are many liquid and each liquid has one > unit. > > On Sep 13, 12:15 pm, "Ivor Paul" <ivorp...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > 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 > > > On 9/13/07, .Tony. <thetony...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > 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--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 On 9/13/07, .Tony. <thetonyest-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Thank you Paul. > I have achieve what I want by following > http://ruby.about.com/b/a/000069.htm > > > > On Sep 13, 12:18 pm, ".Tony." <thetony...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > in a liquid table , there are many liquid and each liquid has one > > unit. > > > > On Sep 13, 12:15 pm, "Ivor Paul" <ivorp...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > 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 > > > > > On 9/13/07, .Tony. <thetony...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > 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 > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I have followed exactly the example in
http://ruby.about.com/b/a/000069.htm
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
On Sep 13, 2:13 pm, "Ivor Paul"
<ivorp...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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
>
> On 9/13/07, .Tony.
<thetony...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
>
> > Thank you Paul.
> > I have achieve what I want by following
> >http://ruby.about.com/b/a/000069.htm
>
> > On Sep 13, 12:18 pm, ".Tony."
<thetony...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > > in a liquid table , there are many liquid and each liquid has one
> > > unit.
>
> > > On Sep 13, 12:15 pm, "Ivor Paul"
<ivorp...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > 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
>
> > > > On 9/13/07, .Tony.
<thetony...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---