Need som help where to look, has_many or?

I would need some help on pointing me to the correct direction. In
application i would like users to be abel to select genres for work
they like to do. A user can be willing to do a lot of genres or just
one. If i still was writing code in .NET i would do a string of id’s
and then save them to the database.

How would one do this in Ruby On Rails, are something like =>

Class User
has_one :profile
end

Class Profile
belongs_to :user
has_many :genres
end

Class Genre
has_many :profiles
end

And then genre would have profile_id and genre_id (so i can get a
translated text for that id).

What would you do ?

On 25 January 2011 06:39, Niklas N. [email protected] wrote:

end
And then genre would have profile_id and genre_id (so i can get a
translated text for that id).

If a profile can have many genres and a genre can have many profiles
then you need a has_and_belongs_to_many association. Have a look at
the Rails Guide on ActiveRecord Relationships for more information.

Colin