Skip to content

Instantly share code, notes, and snippets.

@ryanjones
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save ryanjones/0953319cab81fca2cad9 to your computer and use it in GitHub Desktop.

Select an option

Save ryanjones/0953319cab81fca2cad9 to your computer and use it in GitHub Desktop.

Revisions

  1. Ryan Jones revised this gist Nov 26, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion items_controller.rb
    Original file line number Diff line number Diff line change
    @@ -22,6 +22,6 @@ def update

    def destroy
    item.destroy
    redirect_to(items_url)
    redirect_to(items_path)
    end
    end
  2. Ryan Jones created this gist Nov 26, 2014.
    27 changes: 27 additions & 0 deletions items_controller.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    # controller w/ decent exposure

    class ItemsController < ApplicationController
    expose(:item)
    expose(:items)

    def create
    if item.save
    redirect_to(item)
    else
    render :new
    end
    end

    def update
    if item.save
    redirect_to(item)
    else
    render :edit
    end
    end

    def destroy
    item.destroy
    redirect_to(items_url)
    end
    end