Skip to content

Instantly share code, notes, and snippets.

Created June 23, 2013 17:00
Show Gist options
  • Save anonymous/5845719 to your computer and use it in GitHub Desktop.
Save anonymous/5845719 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Jun 23, 2013.
    18 changes: 18 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    No route matches {:controller=>"users/cms", :action=>"neighbourhood_attractions_destroy"}
    - <td><%= link_to 'Destroy', cms_neighbourhood_attractions_delete_path, method: :delete, data: { confirm: 'Are you sure?' } %></td>

    -------------------------------

    routes.rb:

    delete "admin/neighbourhood_attractions/delete/:id" => "users/cms#neighbourhood_attractions_destroy", :as => :cms_neighbourhood_attractions_delete

    ----------------------------------

    users/cms_controller.rb:

    def neighbourhood_attractions_destroy
    NeighbourhoodAttraction.destroy(params[:id])

    redirect_to :action => "neighbourhood_attractions_index", notice: 'Neighbourhood attraction was successfully deleted.'
    end