Skip to content

Instantly share code, notes, and snippets.

@gavingmiller
Last active December 23, 2015 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gavingmiller/6627622 to your computer and use it in GitHub Desktop.
Save gavingmiller/6627622 to your computer and use it in GitHub Desktop.
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