So I've got three models in my app, a User, Review and a Movie model. A user can review many movies (one per movie), a Movie can have many reviews from many users. Their connection is a review.
Am I doing the following setup right?
class Movie < ActiveRecord::Base
has_many :reviews, :through => :users
end
class Review < ActiveRecord::Base
belongs_to :user
belongs_to :project
end
class User < ActiveRecord::Base
has_many :reviews, :through => :movies
end
I'm hoping I can do something like:
User.reviews
(which would give me back the user's reviews and the corresponding id of the movie which the review relates to)
Thanks