Displaying 4 results from an estimated 4 matches for "howtousemanytomanyagainstasinglet".
2006 Jan 19
5
Multiple HABTM relationships with self ???
I need to have a table related to itself via a join table. Will HABTM
support this? That is:
class Recipe < ActiveRecord::Base
has_and_belongs_to_many :recipes, :join_table => "recipes_recipes"
end
More importantly -- how does RoR support MULTIPLE self-joins? I.e., to
relate the table to itself via multiple join tables.
SFAIK, HABTM won''t support multiple
2005 Dec 19
2
Difficulty using correct moldel for the data in DB
...INTEGER(11),
PRIMARY KEY(`item1_id`,`item2_id`)
);
to have has_and_belongs_to_many relationship but it did not work. I
think it has to do with join table having only the id''s for the items
that are joined.
I''ve also tried to use info from
http://wiki.rubyonrails.org/rails/pages/HowToUseManyToManyAgainstASingleTable
but was unsuccessful.
Because I was unable to come up with a good model for item/fusion and
to limit my database usage, I''m resorting to having controller send
fusions and items ordered by id and doing the following in my view.
<% for fusion in @fusions %>
<% item1 = @Items...
2006 Jul 23
0
Schema design with edge class
I have a situation similar to that described on
http://wiki.rubyonrails.org/rails/pages/HowToUseManyToManyAgainstASingleTable
On that page, someone made the comment:
One might argue also that this is contrived, and you should create a
real Edge class. This way when you finally realise ?whoops, I need to
colour the edges of the graph?, you have somewhere to store that
property.
Which sounds like exactly...
2005 Dec 18
0
Difficulty with creatating a model
...NTEGER(11),
PRIMARY KEY(`item1_id`,`item2_id`)
);
to have has_and_belongs_to_many relationship but it did not work. I
think it has to do with join table having only the id''s for the items
that are joined.
I''ve also tried to use info from
http://wiki.rubyonrails.org/rails/pages/HowToUseManyToManyAgainstASingleTable
but was unsuccessful.
Because I was unable to come up with a good model for item/fusion and
to limit my database usage, I''m resorting to having controller send
fusions and items ordered by id and doing the following in my view.
<% for fusion in @fusions %>
<% item1 = @Item...