I have three tables: books, comments and users. Tables are related. Users can login and then comment on books. Users have a dashboard. How can I make users see the comments that have been made to their books on their dashboard?
Here are the models,
book.rb:

```
class Book < ApplicationRecord
    validates :title, presence: true
    validates :author, presence: true

    belongs_to :user
    has_many :comments
end

```

comment.rb:

```
class Comment < ApplicationRecord
  belongs_to :book
  belongs_to :user

  scope :approved, -> {where(status: true)}
end

```

user.rb:

```
class User < ApplicationRecord

  before_create :set_username

  has_many :books 
  has_many :comments 

  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :validatable

  attr_writer :login

  def login
    @login || self.username || self.email
  end

    # validates_length_of :username,
    #                     :within => 5..50,
    #                     :too_short => " is too short, must be at least 5 characters.",
    #                     :presence => true
  private
  def set_username
    self.username = self.email.split("@").first
  end

  def self.find_first_by_auth_conditions(warden_conditions)
  conditions = warden_conditions.dup

  if login = conditions.delete(:login)
    where(conditions).where(["lower(username) = :value OR lower(email) = :value", { :value => login.downcase }]).first
  else
    if conditions[:username].nil?
      where(conditions).first
    else
      where(username: conditions[:username]).first
    end
  end
  end
end

```

dashboard controller:

```
class DashboardController < ApplicationController
  def index
    @books = current_user.books
  end
end

```