search for: many_to_many

Displaying 8 results from an estimated 8 matches for "many_to_many".

2007 Jan 10
0
many_to_many relationship problem
Hello everyone, i wonder if someone can help i''m a newcomer and this problem is driving me crazy. I have this two models with a habtm relationship Entidad(entity) and Persona(person), on the people view i want to see the entity/es he belongs to and viceversa, so far so good. The thing im getting stuck is with the form that handles the editing to add more people to an entity, heres what i
2006 Oct 16
3
Saving many_to_many
Ahoy, i''m trying to save a many to many between "talent" and "vital stat" talent_controller.rb def edit @talent = Talent.find(params[:id], :include => [:talent_type, :vital_stats]) @talent_types = TalentType.find_all @vital_stats = VitalStat.find_all if request.post? @talent.attributes = params[:talent] @talent.attributes =
2006 Jul 04
8
writing to many_to_many table
I have three tables. users, posts, users_posts. This last one is to mark a post as read. How do I write to the users_post table? Here''s what I have: In model ''User_Post'' belongs_to :post belongs_to :user In post/view/show: <%= link_to "Mark As Read", :controller => ''post'', :action => ''post_read'', :user =>
2012 Sep 21
4
Good resource for the history of activerecord association method naming?
Someone asked me about the history of the method naming in activerecord and I wasn''t sure where to point them. For example, there was early criticism noted of has_and_belongs_to_many in this old post from 2005: http://hans.fugal.net/blog/2005/10/03/habtm/ I was mentioning that many_to_many is not used because there are a few different ways of doing that via has_many :through and has_and_belongs_to_many, and to me belongs_to seems reasonable since it is a model associated with a child table that has a foreign key to a parent table, however that could have been foreign_key_to or si...
2008 Sep 12
1
Referencing exactly two models of the same kind
...ser2; # Receiver end The DB Tables should look something like this: users id messages id, user_id, user2_id; How do the Rails models and the database tables look like? I''m generally wondering how to reference more than one model of the same kind from within another model, without using many_to_many or one_to_many relationships. Fritz --~--~---------~--~----~------------~-------~--~----~ 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 T...
2006 Apr 12
0
datamodell/databasestructure
Hi. I am trying to develop a small utility to manage inventories for outdoor-journeys At the moment I have the following tables to show a many_to_many- relationship between items(like tents/sleepingbags) and users: items <-> holdings(join) <-> users ------------------------------------------------------------------------ -------------------------------------- id user_id id name item_id name ... number passwo...
2011 Jun 13
0
Nested Attributes Link / Save to An Existing Record
Happy Monday Everyone, Would you kindly help out a struggling nuby in solving this problem? I have been researching all over, yet to find a workable solution. Situation: A model [Announcement] that accepts nested attributes [Recipients] via many_to_many :through => :awards relationship. The Desired Outcome: #1. If a recipient''s email in the announcement form is not found in the existing recipients'' data, then a new recipient is created. #2. If a recipient''s email is already in the database, then simply add award to t...
2006 Apr 04
2
HABTM
Hi. Im new to Ruby and new to Ruby on Rails and have problems realizing a =20= simple many_to_many relationship: My tables: items <-> items_users <-> users ------------------------------------------------------------------------=20= -------------------------------------- id user_id = id name item_id name ... = password = ...... My Code: class...