Skip to content

Instantly share code, notes, and snippets.

@RudolfHattenkofer
Created October 7, 2013 07:54
Show Gist options
  • Save RudolfHattenkofer/6864032 to your computer and use it in GitHub Desktop.
Save RudolfHattenkofer/6864032 to your computer and use it in GitHub Desktop.
Resourceable usage
class Category
# GET /categories/new
def new
@category = Category.new
end
# GET /categories/1/edit
def edit
end
# POST /categories
# POST /categories.json
def create
@category = Category.new( category_params )
respond_to do |format|
create_response( @category.save, @category, format, 'Category', admin_category_path(@category) )
end
end
# PATCH/PUT /categories/1
# PATCH/PUT /categories/1.json
def update
respond_to do |format|
update_response( @category, format, category_params, 'Category', admin_category_path(@category) )
end
end
# DELETE /categories/1
# DELETE /categories/1.json
def destroy
@category.destroy
respond_to do |format|
destroy_response( admin_categories_path, format )
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment