1

I'm developing a site that will have a model for users, a model for submissions, and a model for ratings. Each submission may have only one rating per user. My question is how should I set this up in my models?

jklina
  • 3,407
  • 27
  • 42

1 Answers1

5
class Submission
  has_many :ratings
  validates_uniqueness_of :rating, :scope => :user_id
end
Ken
  • 5,074
  • 6
  • 30
  • 26