app/controllers/likes_controller.rb
#if a user has not already liked this post, a new like is created
if a user has not already liked this post, a new like is created
if a user has not already liked this post a new like is created
def create
        if !like_once?  
            @post.likes.create(user_id: current_user.id)
            redirect_to post_path(@post)
        end 
    end
def create if ! like_once? @post . likes . create ( user_id : current_user . id ) redirect_to post_path ( @post ) end end
if a user has not already liked this post, a new like is created
if a user has not already liked this post a new like is created