Marco De Rossi said over 1 year ago on Reactive Applications with Stimulus Reflex :
hello   i need some help . how do i set a like button.

class Business < ApplicationRecord
  belongs_to :user 
  has_many :likes

class Like < ApplicationRecord
belongs_to :user  
belongs_to :business


class User < ApplicationRecord
has_many :likes

<%= button_tag "Like", data: {reflex: "click->Likes#like", id: @business.id} %>

class LikesReflex < ApplicationReflex  
def like    
business = Business.find(element.dataset[:id])    
business.likes.find_or_create_by(user: current_user)  


i need help to set the likeReflex controller .
i want login users to like business and add them to thier user.likes