Remove where clause from followable button partial and rename followable_button partial to follow_button.

This commit is contained in:
Senén Rodero Rodríguez
2017-07-19 17:48:57 +02:00
parent c9a6630c94
commit 119a6b3397
7 changed files with 42 additions and 44 deletions

View File

@@ -3,14 +3,13 @@ class FollowsController < ApplicationController
load_and_authorize_resource
def create
@followable = find_followable
@follow = Follow.create(user: current_user, followable: @followable)
followable = find_followable
@follow = Follow.create(user: current_user, followable: followable)
render :refresh_follow_button
end
def destroy
@follow = Follow.find(params[:id])
@followable = @follow.followable
@follow.destroy
render :refresh_follow_button
end
@@ -20,4 +19,5 @@ class FollowsController < ApplicationController
def find_followable
params[:followable_type].constantize.find(params[:followable_id])
end
end