Skip to content

Instantly share code, notes, and snippets.

@afiq90
Created July 31, 2015 09:09
Show Gist options
  • Save afiq90/4121dcf352728192a113 to your computer and use it in GitHub Desktop.
Save afiq90/4121dcf352728192a113 to your computer and use it in GitHub Desktop.
places controller
module Api
module V1
class PlacesController < Api::ApiController # Api::BaseController
respond_to :json
before_action :authenticate #This authenticate method inherit from Api Controller
skip_before_action :verify_authenticity_token
def index
respond_with @user.places
end
def show
respond_with Place.find(params[:id])
end
def create
respond_with Place.create(params[:product])
end
def update
respond_with Place.update(params[:id], params[:products])
end
def destroy
respond_with Place.destroy(params[:id])
end
# private
# def authenticate
# authenticate_or_request_with_http_token do |token, options|
# current_user.find_by(access_token: token)
# end
# end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment