Skip to content

Instantly share code, notes, and snippets.

@jraczak
Created June 24, 2015 21:51
Show Gist options
  • Save jraczak/427675310f71890f36fd to your computer and use it in GitHub Desktop.
Save jraczak/427675310f71890f36fd to your computer and use it in GitHub Desktop.
# controllers/api/venues_controller.rb
module API
class VenuesController < ApplicationController
respond_to :json
def show
@venue = Venue.find(params[:id])
render json: @venue
#respond_to do |format|
# format.json { render :json => venue }
#end
end
end
end
#routes.rb
...
#API Routes
namespace :api, path: '/', constraints: { subdomain: 'api' } do
resources :venues, only: [ :index, :show ]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment