Skip to content

Instantly share code, notes, and snippets.

@hugodias
Created April 11, 2016 00:57
Show Gist options
  • Select an option

  • Save hugodias/b520d3545ae335d8b7831ab3de1aa251 to your computer and use it in GitHub Desktop.

Select an option

Save hugodias/b520d3545ae335d8b7831ab3de1aa251 to your computer and use it in GitHub Desktop.
# app/controllers/api/v1/posts_controller.rb
module Api::V1
class PostsController < ApiController
before_action :set_post, only: [:show]
respond_to :json
def show
end
private
def set_post
@post = Post.find(params[:id])
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment