Created
October 14, 2013 12:48
-
-
Save warolv/6975061 to your computer and use it in GitHub Desktop.
Backend Example in Rals for Angular (Rails 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
class StaffController < ApplicationController | |
respond_to :json | |
def index | |
respond_with Staff.all | |
end | |
def show | |
respond_with Staff.find(params[:id]) | |
end | |
def create | |
respond_with Staff.create(params[:staff]) | |
end | |
def update | |
respond_with Staff.update(params[:id], params[:staff]) | |
end | |
def destroy | |
respond_with Staff.destroy(params[:id]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment