Displaying 9 results from an estimated 9 matches for "has_many_and_belongs_to_many".
2006 Jul 28
2
Delete has_many_and_belongs_to_many relation
Hi there,
Just a simple question I guess, but I am unable to find an anwser...
How to delete a hmabtm relation?
Any help will be appreciated :)
Thanks,
Fabrice.
--
Posted via http://www.ruby-forum.com/.
2006 Jan 05
3
ActiveRecord setting IDs on auto increment fields
...ry_id` int(10) unsigned default NULL,
`risk_id` int(10) unsigned default NULL,
`created_on` datetime default NULL,
`updated_on` datetime default NULL,
PRIMARY KEY (`id`)
) TYPE=InnoDB;
the code in question is almost directly ripped from this tutorial:
http://jrhicks.net/Projects/rails/has_many_and_belongs_to_many.pdf
def update
...
if @params[:risk_id]
@industry.risks = Risk.find(@params[:risk_id]) if @params
[:risk_id]
else
@industry.risks.clear
end
...
end
and the error looks like this- NOTICE the `id` field getting set to 3...
Mysql::Error: Duplicate entry ''3'...
2006 Jan 12
4
How do you create a tree strucutre with ActiveRecord
...3 | 2 | East |
| 4 | 3 | Yankees |
| 5 | 3 | Red Sox |
+----+-----------+---------+
parent_id is a FK to another domain id. A NULL parent_id indicates it is a
top-level domain. So there would be a users and a domain_users table, and
Domain model object would have a has_many_and_belongs_to_many relationship
with users. But the problem is that would only allow me to query what users
are directly in a given domain. In order to determine what users are in a
given domain, you have to include the child domains has well. So what users
are in domain MLB? The query would be:
SELECT * from do...
2006 Feb 20
1
belongs_to, has_one, has_many question (again?)
...for some page which spills out the relations or
associations within Rails, like:
1:1 relation: has_one, belongs_to in such and such way
1:many relation has_many, belongs_to in such and such way
many:many relation: already has a tutorial of it''s own! (http://
jrhicks.net/Projects/rails/has_many_and_belongs_to_many.pdf)
Thanks,
Tom
2006 Mar 24
1
Has and belongs to many ... howto in the view?
I have a project, it has members. I have the data modeled, the
ActiveRecord setup but I''m running into a block as how to accomplish
this in a view. I would like if when the Project is being edited to
present a list of all users, and then have a checkbox beside each
name. Those selected would be a member, those who are not, obviously
would not be. I am, however, not closed to
2006 Mar 26
3
Making a custom selection form - newbie
Hello all,
I''ve been working with Ruby on Rails for a few weeks now. It''s difficult
for me because I don''t have much experience with Ruby, Rails, MySQL, or
any other web-languages. But I''m trudging on and learning a lot.
I''ve been working on a web application for my dad''s website; it''s a
simple content manager for
2006 Jul 02
2
Problems implementing a N:M table that contains actual data
Hi everyone,
I''m currently finishing the planning phase of a small project I want to
create. I read a bunch of tutorials about ActiveRecord and the
different way to link your "tables" with belongs_to, has_many,
has_and_belong_..., etc... However I''m stillnot sure if what I''m trying
to do will work *well* with ActiveRecord.
So enough talk,
2006 Apr 10
4
Many To Many''s Join table attributes + migrations
...ideas?
I''ve seen the following article but it doesn''t go into enough detail
and straight away bypasses the abstract migration tool using instead
database specific sql (which suggests that the built in features may
not exist for this yet): http://jrhicks.net/Projects/rails/
has_many_and_belongs_to_many.pdf
On a similar note:
How does rails handle the plural expansion of words like ''category''.
i.e., if you have a migration called categories is it going to
correctly use the singular for the model? That kind of naming scheme
doesn''t seem to make sense in enough situ...
2006 Mar 30
5
Heeelp - no idea what''s going wrong.
I''m working on a simple CMS. The main data type are "listings" a listing
habtm (has_and_belongs_to_many) categories and subcategories.
Subcategories belong_to categories. Subcategories are basically the same
as categories, but they are treated differently in a few situations.
The problem is, I can''t seem to write the view/controller/model code
that allows me to