Skip to content

Instantly share code, notes, and snippets.

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