Created
July 31, 2015 09:09
-
-
Save afiq90/4121dcf352728192a113 to your computer and use it in GitHub Desktop.
places controller
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
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