search for: bars_foos

Displaying 3 results from an estimated 3 matches for "bars_foos".

2006 Aug 09
3
HABTM and getting to arrays from either direction
I didn''t find exactly an answer on this one, so I''d like to get a clarification from folks who live & breathe HABTM. class foo has_and_belongs_to_many :bars end class bar has_and_belongs_to_many :foos end (and yes, I have a bars_foos table in my db) def test_habtm bar = Bar.new foo = Foo.new foo.bars<<bar assert !foo.bars.empty? assert !bar.foos.empty? end My first assert passes just fine. But the 2nd fails. Am I wrong on the concepts of HABTM? Shouldn''t the << operator add to the join table...
2006 Jul 03
6
help!
Hi, i''m fairly new to ruby on rails, and i know the question at hand may seem simple at first, but i''m getting really caught up in trying to understand this and the docs aren''t giving me answer. i actually thought i knew how the sql commands work (like :include, :conditions, :etc) but obviously, i don''t. there are three models M1, M2, M3 joined by a habtam
2006 Apr 29
5
HABTM - how to insert join row when associated rows exist
I have successfully used HABTM to create a many-to-one-to-many set of rows in one step. Now, if two objects I want to associate already exist, how do I create the join row? The Agile book mentions the ''push_with_attributes'' method. The text says this method is useful for adding additional attributes to the join row (in the example a ''read_at'' timestamp). I