Skip to content

Instantly share code, notes, and snippets.

@warolv
Created October 14, 2013 12:48
Show Gist options
  • Save warolv/6975061 to your computer and use it in GitHub Desktop.
Save warolv/6975061 to your computer and use it in GitHub Desktop.
Backend Example in Rals for Angular (Rails Controller)
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