On 11.4.2005, at 08:13, Fernando Blat Peris wrote:
> I''d like to know how do you model the next situation:
>
> imagine you have two models: author and article. Each author has_many
> articles and each article belongs_to an author. And know how to model
> this.
Author:
has_many :articles
has_and_belongs_to_many :favorite_articles, :class_name =>
"Article"
See [1] for more information.
//jarkko
[1]
http://rails.rubyonrails.com/classes/ActiveRecord/Associations/
ClassMethods.html
>
> But now, imagine you want each author can have some favorites
> articles, written by other authors. It is a has_and_belongs_to_many
> relation, but could it be combined with the other relation mentioned
> before?
>
> Thanks
> --
> Fernando Blat Peris
> <ferblape-I8oKXW6Z+bze5aOfsHch1g@public.gmane.org>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
Jarkko Laine
http://jlaine.net
http://odesign.fi
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails