Last active
December 23, 2015 11:19
-
-
Save gavingmiller/6627622 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WellsController < BaseController | |
def follow | |
@well = Well.find(params[:id]) | |
if params['follow'] == 'true' | |
authorize! :follow, @well | |
current_user.follow(@well) | |
else | |
# Allow a user to unfollow a well even | |
# if they've reached their limit | |
current_user.stop_following(@well) | |
end | |
render json: current_user.all_following, status: :ok | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment