[Rails] ActiveRecord and Many to Many relationships.
Tanner Burson
tanner.burson at gmail.com
Thu Dec 16 21:44:19 GMT 2004
Let me preface this with the fact that I've been working with rails
for about two weeks, so if I'm missing something obvious, feel free to
give me a link and tell me to RTFM :)
I'm working on a pretty simple photogallery application. I've just
barely begun laying it out, but I will have several many to many
relationships in the database.
Ex. A single image may have multiple categories and each category may
be attached to many images.
Obviously I'll have join tables to break it up into several one to
many relationships. What my question is, while looking in the model
functions like belongs_to, has_one, has_many etc, I see no way to
easily describe this relationship. To access all categories for a
given image, will I have to use a SQL or is there something in
ActiveRecord that will ease this?
Thanks,
Tanner Burson
More information about the Rails
mailing list