milan quendera
2005-Jun-14 15:05 UTC
Re: A newbie question, find several documents but still can''t fiigure out
> My question is, if I have 2 tables,>What do your models look like?>Duane Johnson >(canadaduane)looks like: ****file tablea**** class Table_a < ActiveRecord::Base belongs_to :table_b end *****file tableb**** class Table_b < ActiveRecord::Base has_many :table_a end still can''t figure out why it can''t work? any directions will be helpful. thanks.... _________________________________________________________________ MSN 相簿提供您最簡單的方式分享並列印您的相片,請移至 : http://photos.msn.com.hk/support/worldwide.aspx
chen ge
2005-Jun-14 15:15 UTC
Re: A newbie question, find several documents but still can''t fiigure out
There is an article at onlamp.com maybe help for you! GregChen(from China) On 6/14/05, milan quendera <mkpolo@msn.com> wrote:> > My question is, if I have 2 tables, > > >What do your models look like? > > >Duane Johnson > >(canadaduane) > > looks like: > > > ****file tablea**** > class Table_a < ActiveRecord::Base > belongs_to :table_b > end > > *****file tableb**** > > class Table_b < ActiveRecord::Base > has_many :table_a > end > > > still can't figure out why it can't work? any directions will be helpful. > thanks.... > > _________________________________________________________________ > MSN 相簿提供您最簡單的方式分享並列印您的相片,請移至 : > http://photos.msn.com.hk/support/worldwide.aspx > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Duane Johnson
2005-Jun-14 15:20 UTC
Re: A newbie question, find several documents but still can''t fiigure out
On Jun 14, 2005, at 9:05 AM, milan quendera wrote:> looks like: > > > ****file tablea**** > class Table_a < ActiveRecord::Base > belongs_to :table_b > end > > *****file tableb**** > > class Table_b < ActiveRecord::Base > has_many :table_a > end > > > still can''t figure out why it can''t work? any directions will be > helpful. thanks.... >Here''s what your model should look like: class TableA < ActiveRecord::Base belongs_to :table_b end class TableB < ActiveRecord::Base has_many :table_as end I (personally) would use different names for your tables, since TableA and TableB aren''t very descriptive. But that''s just me :) Duane Johnson (canadaduane) _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails