Created
August 22, 2013 12:52
-
-
Save spullen/6306739 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class ProtocolsController < ApplicationController | |
respond_to :json | |
before_action :set_protocol, only: [:show, :update, :destroy] | |
def index | |
respond_with @protocols = Protocol.ordered | |
end | |
def show | |
respond_with @protocol | |
end | |
def create | |
respond_with @protocol = Protocol.create(protocol_params) | |
end | |
def update | |
@protocol.update(protocol_params) | |
respond_with @protocol | |
end | |
def destroy | |
@protocol.destroy | |
respond_with @protocol | |
end | |
private | |
def protocol_params | |
params.require(:protocol).permit(:protocol_number, :title, :pi_name) | |
end | |
def set_protocol | |
@protocol = Protocol.find(params[:id]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment