Skip to content

Instantly share code, notes, and snippets.

@tonyc
Last active December 19, 2015 02:59
Show Gist options
  • Save tonyc/5886909 to your computer and use it in GitHub Desktop.
Save tonyc/5886909 to your computer and use it in GitHub Desktop.
class ThingsController < ApplicationController
load_and_authorize_resource :thing
def index
respond with @things
end
def show
respond_with @thing
end
def edit
respond_with @thing
end
def update
@thing.update_attributes(thing_params)
respond_with @thing
end
def new
respond_with @thing
end
def create
respond_with @thing.tap(&:save)
end
def destroy
respond_with @thing.tap(:destroy)
end
private
def thing_params
params.require(:thing).permit(:foo, :bar)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment