thirteen-tien-len/app/controllers/relationships_controller.rb

16 lines
367 B
Ruby

class RelationshipsController < ApplicationController
def create
profile = Profile.find(params[:followed_id])
authorize Relationship
current_user.follow(profile)
redirect_to profile
end
def destroy
profile = Relationship.find(params[:id]).followed
authorize profile
current_user.unfollow(profile)
redirect_to profile
end
end