I’ve quite a simple query regarding models.
I have a model –
class User < ActiveRecord::Base
has_one :interest
end
And another –
class Interest < ActiveRecord::Base
belongs_to :donor
end
My Interest table is prepolated with interests – “football”, “swimming”, “tennis”
Each user can only have one interest, but an interest can have many users.
My set up at the moment seems to allow an interest to only have one user.
What am I doing wrong?
Simply set
has_manyonInterestandbelongs_toonUser. Remember about Rails convention in naming things:..and…