I am using acts_as_follower in my rails application so that a user can follow a book. My controller is given below. I also have a current_user method.
I want to add an additional field "isFolowing" to the pages response ,This is to check if the current user is following that particular page or not. acts_as_follower gem provides a method user.following?(book) to check if a user is following a particular book.
Please help me to add this additional field "isFollowing" to the response
class BooksController < ApplicationController
def index
@books=Book.all
render json: @books
end
end