Skip to content

Instantly share code, notes, and snippets.

@billyboozer
Created June 19, 2014 16:12
Show Gist options
  • Save billyboozer/071bc0994412b1eac6d2 to your computer and use it in GitHub Desktop.
Save billyboozer/071bc0994412b1eac6d2 to your computer and use it in GitHub Desktop.
class Api::V1::LeadsController < ApplicationController
respond_to :json
def index
respond_with Lead.all
end
def show
respond_with lead
end
def create
respond_with :api, :v1, Lead.create(lead_params)
end
def update
sleep 1
respond_with lead.update(lead_params)
end
def destroy
respond_with lead.destroy
end
private
def lead
Lead.find(params[:id])
end
def lead_params
params.require(:lead).permit(:first_name, :last_name, :email, :phone, :status, :notes)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment