Some help please! How do you fill the table with the three foreign keys?? i put user = User.new tag = Tag.find(id) article = Article.find(id) user.tag << tag user.article << article
user.save all this creates 2 tuples on the database articles_tags_users instead of one with all the values On Sat, Oct 25, 2008 at 6:02 AM, Panda Beer < [email protected]> wrote: > > YES! I found the answer: > > class Article < ActiveRecord::Base > has_and_belongs_to_many :tags, :join_table => :articles_tags_users > has_and_belongs_to_many :users, :join_table => :articles_tags_users > end > > class Tag < ActiveRecord::Base > has_and_belongs_to_many :articles, :join_table => :articles_tags_users > has_and_belongs_to_many :users, :join_table => :articles_tags_users > end > > class User < ActiveRecord::Base > has_and_belongs_to_many :articles, :join_table => :articles_tags_users > has_and_belongs_to_many :tags, :join_table => :articles_tags_users > end > > have fun! > -- > Posted via http://www.ruby-forum.com/. > > > > -- Felipe Vergara Contesse IngenierĂa Civil Industrial UC --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

