Here's a diagram which might help with your model: http://learn.kohanaphp.com/wp-content/uploads/2008/04/ruby-on-rails-data-relationships.png
Make sure you also check: http://guides.rubyonrails.org/association_basics.html ============ The best advice I can give you is to draw a complete diagram with all your models either on paper or a drawing board, or in a program (your choice). Once you diagram the pattern you can write the relationship on the lines. The reason why I say to do this goes much farther back than Rails when I worked with Crystal Reports. Diagrams allow you to see the associations better. Looking at what you provides so far let's go ahead and diagram it exactly the way you wrote it and see what's wrong here. I'm leaving off activerecord base for sake of clarity... class Person belongs_to :favorite_color, :class_name => "Color", :foreign_key => "color_id" has_many :addresses, :dependent => :destroy end class Address belongs_to :product end class Color #don't need anything end ============================= First thing I don't see is your relationship models for Product or FavoriteColor. So, creating them based off what you wrote above I see: class Product has_many :addresses end class FavoriteColor has_many :persons has_many :addresses, :through => :persons end But, you have class Address belonging to Product but your association for Person is stating that addresses belong to it. Which does address really belong to? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

