So I have these models:
class User < ActiveRecord::Base has_many :ratings end class Rating < ActiveRecord::Base has_many :restaurant_ratings has_many :restaurant, through: :restaurant_ratings has_many :belongs end class Restaurant < ActiveRecord::Base has_many :restaurant_ratings has_many :ratings, through: :restaurant_ratings end class RestaurantRating < ActiveRecord::Base belongs_to :restaurant belongs_to :rating end
Currently, when I want to view a restaurant on the controller's show method it works just fine. But right now, I am trying to figure out a way to filter a specific rating based on the current restaurant that is being viewed or shown as well as the current user who is logged in.
How would I best tackle this?