Ruby on rails toggling favourite button using jquery and ajax comes with "rendering head :no_content Completed 204 No Content' : I am trying to create a favourite button where users will be able to use toggle button to 'favourite' a post and 'unfavourite' same depending on what they like. So far if I 'unfavourite' the post it seems to work but whenever i do otherwise the link does not change. I used jquery and ajax.

    class FavouritesController < ApplicationController
    before_action :authenticate_user!

    def create
    @favourite = current_user.favourites.build(favourite_params)
    if @favourite.save
    @post = @favourite.post
    respond_to :js
    else
    flash[:alert] = "something went wrong..."

    end

    end


    def destroy
    @favourite = Favourite.find(params[:id])
    @school = @favourite.post
    if @favourite.destroy
    respond_to :js

    else
	flash[:alert] = "Something Went Wrong..."


	end
    end

    private
    def favourite_params
	params.permit :user_id, :post_id
    end

    end





HERE ARE THE MODELS
    class Post < ApplicationRecord
    belongs_to :user
    has_many :favourites

    def is_favourited user
	Favourite.find_by(user_id: user.id, school_id: id)
	
    end

    end

FAVOURITE MODEL
    class Favourite < ApplicationRecord
    belongs_to :user
    belongs_to :post
    end


CREATED J.S IN THE FAVOURITE VIEW FOLDER IE VIEWS/FAVOURITES/created.js.erb

    $('#favourite').html('<%= j render "posts/favourite", {is_favourited: 
  @is_favourited, post: @post} %>');
console.log("Added to your favourite List");




CREATED J.S IN THE FAVOURITE VIEW FOLDER IE VIEWS/FAVOURITES/destroy.js.erb
/destroy.js.erb

    $('#favourite').html('<%= j render "posts/favourite", {is_favourited: 
    @is_favourited, post: @post} %>');
console.log("Added to your favourite List");


FAVOURITE PARTIAL FILE IN THE POSTS FOLDER IE VIEWS/POSTS/_favourite.html.erb

<% if @is_favourited.present? %>
<%= link_to "favourited", favourite_path(@is_favourited), method: :delete, remote: true, id: 'favourited' %>


<% else %>
  <%= link_to "favourite", post_favourites_path(@post), method: :post, remote: true, id: 'favourite' %>

  <% end %>


ON THE SHOW PAGE OF THE POST I RENDERED THE PARTIAL LIKE THIS
    <%= render 'favourite' %>
