Remove where clause from followable button partial and rename followable_button partial to follow_button.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user